Combining the timer and loop

Somehow, I thought this might work:

for (var a: number = 0; has < total; ++);

{

code

code

code

code

var autoTimer:Timer = new Timer (4000, 1);

autoTimer.addEventListener (TimerEvent.TIMER, autoSlide);

function autoSlide(e:TimerEvent):void

{

trace (URL);

}

}

The idea is to load a URL (code charger not included in this) in an XML list every four seconds. The loop must not repeat the cycle until the function is complete. But he shakes down all 99 URL in a fraction of a second. I'm so bad (think)?

Any help much appreciated.

Thank you.

Why don't you try just a simple timer?

Well, if you really need a variable number as when you use a loop for example, you can use something like this:

var waitingTime = 1000;
var xmlListLenght = 15+1; //+1 just to remember that your xmlList starts with 0
var timesToLoop = xmlListLenght;
var xmlListItem = 0;

var myTimer:Timer = new Timer(waitingTime, timesToLoop);
myTimer.addEventListener("timer", timerFunction); //TimerEvent.TIMER
myTimer.start();

function timerFunction (e:TimerEvent) {
     trace(String(xmlListItem) + " working");
     xmlListItem++;
}

I hope it works for you!

Tags: Adobe Animate

Similar Questions

Maybe you are looking for