Professional Web Applications Themes

pass variable to custom function not working MX - Macromedia Flash Actionscript

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 ...

  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. #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

Similar Threads

  1. The variable won't pass
    By weswhite7 in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: July 8th, 06:10 AM
  2. How to pass a variable to a second page
    By chill84 in forum Macromedia ColdFusion
    Replies: 5
    Last Post: May 18th, 04:49 AM
  3. Login needs to pass variable
    By *thirtysixsquares* in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 4th, 11:03 AM
  4. How to pass a variable to .t file
    By Rajesh Dorairajan in forum PERL Beginners
    Replies: 3
    Last Post: November 4th, 07:14 PM
  5. [PHP] Still can't pass variable through url
    By Joe Harman in forum PHP Development
    Replies: 1
    Last Post: August 8th, 06:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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