How to add a delay to a loop?
i want repeatedly add movie stage using add child have created loop add 30 times. how can make aren't added @ same time. i'd able set interval of time between them being added.
thanks.
thanks.
something do:
var atimer:timer = new timer(500,30);
atimer.addeventlistener(timerevent.timer,addone);
atimer.start();
function addone(e:timerevent){
var anmc:mymovieclip = new mymovieclip();
addchild(anmc);
}
as stands movieclips ("mymovieclip" name used when set symbol sharing in library) added every half second, on top of each other. want set anmc.x , anmc.y position need before doing addchild().
the event has property called currentcount, use figure out 1 gets placed. like:
anmc.x = e.currentcount * 20;
would spread 30 movieclips across stage, 20 pixels further along each time.
var atimer:timer = new timer(500,30);
atimer.addeventlistener(timerevent.timer,addone);
atimer.start();
function addone(e:timerevent){
var anmc:mymovieclip = new mymovieclip();
addchild(anmc);
}
as stands movieclips ("mymovieclip" name used when set symbol sharing in library) added every half second, on top of each other. want set anmc.x , anmc.y position need before doing addchild().
the event has property called currentcount, use figure out 1 gets placed. like:
anmc.x = e.currentcount * 20;
would spread 30 movieclips across stage, 20 pixels further along each time.
More discussions in ActionScript 3
adobe
Comments
Post a Comment