View Full Version : Need help with storing loop value in movieclip
gazc
September 17th, 2004, 12:58 PM
This is really holding me up, so I hope someone can help me fast.
I need to store each value of my for loop in a separate instance of my movieclip, but the movieclip only seems to pick up the last value of the loop.
Why is this and can I do this any other way apart from storing the value in a textfield or creating a loop within the movieclip?
stringy
September 17th, 2004, 01:14 PM
This is really holding me up, so I hope someone can help me fast.
I need to store each value of my for loop in a separate instance of my movieclip, but the movieclip only seems to pick up the last value of the loop.
Why is this and can I do this any other way apart from storing the value in a textfield or creating a loop within the movieclip?
can show copy/paste the code
gazc
September 17th, 2004, 02:51 PM
In the end I got it to work by combining two methods. I used the following code:
in main timeline:
for (var i=0; i < 3; i++){
this.attachMovie("mcClip","clip"+i,i);
this["clip"+i].count=i;
}
in mcClip:
var loopval=count;
// this was set to 0 previously, which blanked out the loaded value.
this.onPress = function(){
trace(loopval);
}
thought this might help anyone who is having the same problem.
amitgeorge
September 18th, 2004, 12:18 AM
attachMovie, Loadmovie, gotoplay etc all are executed after all the frame code is executed.
so do something like this
// frame 5
for (var i=0; i < 3; i++){
this.attachMovie("mcClip","clip"+i,i);
}
// frame 7
for (var i=0; i < 3; i++){
this["clip"+i].count=i;
}
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.