PDA

View Full Version : Dynamic Variables for Movieclips



arunforce
March 25th, 2009, 03:28 AM
How do you do something like

["button"+num].gotoAndStop(2)
eval("button"+num].gotoAndStop(2) doesn't work either?

Also how do you do _root.?

like _root["button"+num"].gotoAndStop(2)?

I'm migrating to AS3. :/

Thanks in Advanced.

snickelfritz
March 25th, 2009, 03:39 AM
this["button" + num].gotoAndStop(2);

JYCaR
March 25th, 2009, 04:58 AM
OR...

You can use:

getChildByName("button" + number).goToAndStop(2);

if it doesn't work, you have to cast it - for example:

MovieClip(getChildByName("button" + num)).goToAndStop(2);

hope this helps...