|
-
Expert - Changing movie frame (gotoAndPlay) in a for loop using a counter
I'm having some difficulties using counters. Specifically related to using the gotoAndPlay (or Stop) command within a 'for' loop. This does not relate to the layers of attached movie clips but the counter of the for loop 'i'.
Below is an example of code that works. Imagine a movie clip called 'Card' that is added to the main Movie using a for loop with instance names Card0, Card1, Card2, ... etc. Within the movie clip 'Card' there are variables which can be set using a pre-defined array. The variable is called Var1 and is accessed using the code "Card0.Var1" in the case that i=0.
for(i=0;i<NCards;i++){
this.attachMovie( "Card", "Card"+i, Layer );
Layer++;
set ("Card"+i+".Var1",Value[i]);
}
Now imaging there's a movie clip within 'Card' with the instance name "Image". To change the frame of that movie clip you would simply use the following code:
Card0.Image.gotoAndStop(3);
The code that I cannot make work looks a little like either of the following 2 codes below:
for(i=0;i<NCards;i++){
"Card"+i+".Image".gotoAndStop(3);
}
or
setProperty("Card"+i+".Image",_currentframe,3);
Basically it seems that the gotoAndStop function doesnt get on with concatenated text (added together text). Any help would be much appreciated!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|