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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I change the name of a instance dinamically?

Status
Not open for further replies.

jbezzina

MIS
May 4, 2004
46
MT
I am creating a photo gallery and have created 20 movie clips (called thumbHolder1 all the way to thumbHolder20) these will hold the 20 thumbnails that are loaded using MovieClipLoader.

So far no problem, but is there a way avoid having to enter the following code 20 times (and change the name every time)?

myMCL.loadClip("gallery/tn_photo" + picNum + ".jpg", this.thumbHolder1);

What i need is a way to use a for loop and add 1 at the end of the name of the instance (thumbHolder*)
I also need to use the same thing with a name of a dinamic text field

Thanks !!

 
Code:
for(i=1;i<21;i++){
myMCL.loadClip("gallery/tn_photo" + picNum + ".jpg", this["thumbHolder"+i]);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top