Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

actionscript: get object from its string name

Status
Not open for further replies.

sansei

Programmer
Jan 29, 2003
8
PL
Hello everyone

I've put many instances of single movie clip on 'scene1'.
I named them 'car11', ..., car'55' (array 5x5)
Now in actionscript I need to change their visibility, but I have only strings with their names.

After some calculations I get: i=4; j=2;
So name would be: name = "car" + i + j;
Now I would like to hide this movie clip 'car42'.
I can't do this: _root.name._visible = false;
becouse 'name' is only a string object not a movie clip object.
How can I create a movie clip variable from this string?
Is it possible? or do I have to find a different workaround?
 
This should do it:

this['car'+i+j]._visible=false;
 
Thanks for help. It's easier than would ever thought :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top