pass variable to custom function not working MX

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default pass variable to custom function not working MX

    I have an app that I built in Flash 5 that I want to output in Flash MX (not
    2004, though) but part of my code, which works fine as Flash 5 swf, breaks in
    Flash 6 swf. I am loading text from an external text file, and then passing the
    text contents of each variable to a function (to strip line breaks). Following
    is the code... does anyone know how to rewrite this so that it will work in
    Flash 6? The contents of the variable are not getting passed, and eval does not
    work on left side of expression...

    Thanks in advance for help.

    -S

    // content, correct, Q1, Q2, Q3, etc are all variable loaded from external
    text file. I am trying to pass contents of variables, which is why I need to
    eval them. This worked in Flash 5, but not in Flash MX if I publish as Flash
    Player 6 file.

    temp = stripLineBreak("content");
    temp = stripLineBreak("correct");
    for (i=1; i<=10; i++){
    z="Q"+i
    temp = stripLineBreak(z);
    }

    function stripLineBreak(x) {
    tempArray = new Array();
    tempArray = eval(x).split("\r");
    eval(x) = tempArray.join("");
    tempArray.splice(0,tempArray.length);
    tempArray = eval(x).split("\n");
    eval(x) = tempArray.join("");
    tempArray.splice(0,tempArray.length);
    }

    amphibianZ Guest

  2. Similar Questions and Discussions

    1. The variable won't pass
      The problem I am having is with setting a variable which would hold an id and it would be used on multiple pages. The variable should change when...
    2. how to pass variable in TitleWindow
      hi all , can we pass variable in TitleWindow ??? where i put my variable??? mx.managers.PopUpManager.createPopUp(_root, inVoice,true,...
    3. Login needs to pass variable
      The profile form CFINCLUDEs the login page in the header. If I attempt to view the profile.cfm?userID=XX I am switched to the login form as...
    4. How to pass a variable to .t file
      Can someone help me understand how does one pass variable to a Perl test script from the calling program? Is such a mechanism available? To...
    5. [PHP] Still can't pass variable through url
      <?php $year=1999; $month=march; echo "<a href=\"http://www.thingamajigger.com/index.php?year=$year&month=$month\" ?>
  3. #2

    Default Re: pass variable to custom function not working MX

    I can't test this because I don't have your data or .FLA, but this could do
    it:

    temp = stripLineBreak(this.content);
    temp = stripLineBreak(this.correct);
    for (i=1; i<=10; i++) {
    z = this["Q"+i];
    temp = stripLineBreak(z);
    }
    function stripLineBreak(x) {
    tempArray = new Array();
    tempArray = x.split("\r");
    x = tempArray.join("");
    tempArray.splice(0, tempArray.length);
    tempArray = x.split("\n");
    x = tempArray.join("");
    tempArray.splice(0, tempArray.length);
    }




    hth
    }`¬P

    --
    ---------------------------------------
    [url]http://www.phageinteractive.com[/url]
    PhageInteractive Ltd.
    remove mm_ to mail
    ---------------------------------------
    'I wish we lived in a world where it was possible to be religious and think
    at the same time.' - Jonh Graves


    Peter Blumenthal Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139