Hi There,
I'm trying to clean up my code. Say I have 8 movieclips that I want to fade in at different times...
writing it this way seems to work but how would I write it to be in a loop instead of repeating it so many times?
import gs.TweenLite;
import gs.easing.*
TweenLite.to(mc1, Math.random()*50, {alpha:1});
TweenLite.to(mc2, Math.random()*50, {alpha:1});
TweenLite.to(mc3, Math.random()*50, {alpha:1});
TweenLite.to(mc4, Math.random()*50, {alpha:1});
TweenLite.to(mc5, Math.random()*50, {alpha:1});
TweenLite.to(mc6, Math.random()*50, {alpha:1});
TweenLite.to(mc7, Math.random()*50, {alpha:1});
TweenLite.to(mc8, Math.random()*50, {alpha:1});
------------------------------------------------------
Here was my attempt at the loop. But it has errors.
var movieClips:Number = 1; //tracks how many movie clips
addEventListener(Event.ENTER_FRAME,myEnterFrame);
function myEnterFrame(event:Event) {
if (movieClips <= 8) {
var mc:String = "mc"+movieClips;
trace(mc);
TweenLite.to(mc, Math.random()*50, {alpha:1});
movieClips += 1;
}
}
Thanks!