sozugk
1
Hi,
I have question that I believe should be simple. Here it is;
instead of writing for example;
test.gotoAndPlay(2);
I wrote this but does not seem to work;
x = “test”;
x.gotoAndPlay(2);
Is there a format that I should use to get this to work? Thanks.
system
2
try this…
dont know if it’ll work but what the hey…
x = eval("_root.test");
x.gotoandPlay(2);
i know this works when doing dynamic stuff:
for(i=0;i<5;i++){
_root["movieclip" + i].play();
}
hmm =)
system
3
works!! thx… what does eval do anyways?
system
4
eval( ) works when you want to evaluate something as litteral… such as a variable name etc…
since you were doing
x = “test”; it was assigning it as a string.
if you do the eval(“test”) it goes, ok, this must be a variable name or an object or something other than a string =)
its intended for dyanamic thigns , its most handy =)
system
5
the eval way is deprecated in MX, so you might just wanna stick with the 2nd method :):
x = "test"
_root[x].gotoAndPlay(2);
system
6
or do what ahmed said… =)
even though eval() is still king in other languages… =)
system
7
nice! thanks for the help Raydred and ahmed 