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

using a loop to refer to movieclips?

Status
Not open for further replies.

dellengwyn

Technical User
Sep 23, 2000
7
BS
In my movie, I am duplicating movie clips, and naming them dynamically by incrementing a variable (e.g., call them clip1, clip2, clip3, etc.)

I want to compare the value of a variable in each of these clips to a value in an "if" statement. The variable is named IDnumber. The if statement is inside a "for" loop. I want to use the incrementing variable of the "for" loop to dynamically step through the clips and check the IDnumber value. So, here is the question:

How do I refer to the movie clip using a variable in its name?

I have tried, for example:

if (["clip" + i].IDnumber == 3)


Let's say that i=5. It seems as if Flash is unable to interpret this as referring to the variable clip5.IDnumber

I've tried trace() to output the value, just to see if my syntax is working, but every permutation I've tried fails to output the value of IDnumber.

Needless to say, I am using Flash 5. I am not well versed in slash syntax, so I haven't tried that yet.

Anyone have any ideas?
 
could you use "clip" & i ... instead of clip + i ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top