I have a loop that creates MCs on the stage in a grid, my problem is it loops through instantly, is there anyway to put a pause in so that each movie clip is added to the stage say every second?
Thanks
Printable View
I have a loop that creates MCs on the stage in a grid, my problem is it loops through instantly, is there anyway to put a pause in so that each movie clip is added to the stage say every second?
Thanks
This is actually the first point that most AS3 animation books bring up – all of your code needs to finish for a frame before the next one will render. The basic message is that loops don't really work for tweening or transitions over time.
The solution is either an event (like EnterFrame) or a custom Timer...for once every second here's how you'd set that up:
PHP Code:
// new timer, fires every 1000 milliseconds
var t:Timer = new Timer(1000);
// every timer-tick, call addMC();
t.addEventListener(TimerEvent.TIMER, addMC);
// start the timer
t.start();
function addMC(e:TimerEvent):void{
addChild(new MovieClip());
// ...
}
I have a banner ad that has 3 loops and stops, problem is it loops through instantly, is there anyway to put a delay in-between the loops so if someone wants to click on the button they can?
Thanks