A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: eval script in MX

  1. #1
    Flash Initiate StuartW's Avatar
    Join Date
    Jul 2000
    Location
    The Metaverse
    Posts
    504

    eval script in MX

    Hello,

    I'm just moving from Flash 5 to MX and I'm having some trouble with some code that worked fine in F5 but doesn't want to work in MX.

    Could someone point me in the right direction?

    This script is on a button. As you can see it's targetting a MC which is part of an array. It's generating the things to link to and move on the fly. This all worked fine in F5, but FMX does not like my eval statement being on the left side in this line: eval("_root.text" +n+ ".xend") = 10;

    Full script:

    on (rollOver) {
    n = 1;
    link[n] = eval("_root.link"+n);
    link[n].fade = 100;
    eval("_root.text" +n+ ".xend") = 10;
    }
    on (rollOut) {
    link[n].fade = 20;
    eval("_root.text"+n+".xend") = -200;
    }

    Any ideas?

    Thanks in advance.

    Kindest Regards,

    Stu

  2. #2
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Code:
    on (rollOver) {
    	n = 1;
    	link[n] = _root["link" + n];
    	link[n].fade = 100;
    	_root["text" + n + ".xend"] = 10;
    }
    on (rollOut) {
    	link[n].fade = 20;
    	_root["text" + n + ".xend"] = -200;
    }

  3. #3
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    I'm just curious: why do you use eval? What do you want it to do?

  4. #4
    Flash Initiate StuartW's Avatar
    Join Date
    Jul 2000
    Location
    The Metaverse
    Posts
    504
    Cheers people...

    I just tried that and it should work - but it doesn't, only this time it throws up no errors? (it also works in F5 but not MX!!!!)

    I think something strange is afoot.

    Thank you anyway, if you think of anything else it would be much appreciated.

    Stu

    P.S. In answer to The Caramella, I was previously using eval in this line:

    eval("_root.text" +n+ ".xend") = 10;

    to get flash to see it as

    _root.text1.xend = 10;

    As I have many instances of this I use the code as a function and just change the value of n to target different movieclips.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center