Groups | Blog | Home
all groups > flash actionscript > october 2005 >

flash actionscript : string to instance


dbento
10/24/2005 9:32:48 PM
I have a variable with a string. That string has the same name as a movieclip intance. However i connot access the movieclip with the string as an instance?

NSurveyor
10/24/2005 9:46:41 PM
Use this syntax:

pathToObj[objString]

ex:
_root["helloKitty"] is the same as _root.helloKitty
this["football"] is the same as this.football

So, if you had a movieclip, this.clips.happyClip, you might have:

clipName = "happyClip";
mc = this.clips[clipName];
AddThis Social Bookmark Button