-
How can I use a variable for an action? If I set variable "myAction" =
gotoAndStop(2), how can I call on it to perform the action? Here's an
example of what I'm trying to do:
VARIABLE VALUE
myAction1 _root.gotoAndStop(2);
myAction2 getURL("http://www.mydomain.com","_blank");
So, if I have a movieClip button with the actions set by the "onRelease"
action, how can I make it perform the action? The following is an example
of what I've been trying but it doesn't work:
myButtonMC1.onRelease = funtion(){
this[myAction1];
}
myButtonMC2.onRelease = funtion(){
this[myAction2];
}
Thanks for any help,
Scott
-
How can I use a variable for an action? If I set variable "myAction" =
gotoAndStop(2), how can I call on it to perform the action? Here's an
example of what I'm trying to do:
VARIABLE VALUE
myAction1 _root.gotoAndStop(2);
myAction2 getURL("http://www.mydomain.com","_blank");
So, if I have a movieClip button with the actions set by the "onRelease"
action, how can I make it perform the action? The following is an example
of what I've been trying but it doesn't work:
myButtonMC1.onRelease = funtion(){
this[myAction1];
}
myButtonMC2.onRelease = funtion(){
this[myAction2];
}
Thanks for any help,
Scott
-
myaction = "gotoAndStop(2)";
eval(myaction);
using eval will treat the string in your variable as actionscript. http://www.talkgraphics.com/images/smilies/smile.gif
hth,
Deep (just a guy)
<font face="arial" size="2">
Pradeep Kumar Nair, B.Math
Content Manager
9 Story Entertainment
http://www.9story.com
ICQ: 39102360
</font>
-
I would have never thought of that. I haven't tried it yet, but I definitely will. I'll let you know how it works out.
I haven't been to this board for some time now, but I'm glad I checked it out tonight!!
Thanks Deep!!
Scott
-
Hi Deep,
I tried using eval to treat the variable value as actionscript, but it's not working. I just used the code you posted. Is there something missing?
Thanks a million, and you're still the greatest!
Scott