Help - Search - Members - Calendar
Full Version: Pausing
Pixel2Life Forum > Help Section > Adobe Flash
Metameta
I was wondering if theres some code that makes it pause before going to the next line of code in actionscript 3!! I cant find anything, and the ones I do find are likek 100000 lines of code =_= I want something that just makes it not execute the next line of code for 3 seconds or something?!

Something as simple ass pause(3); would be nice but apparently they don't have that haha, I gonna be using quite a bit and I dont want to have 1000 lines of code for each pause I do.
GRIMESD
Yes, there is a way, it is called a Timer event. Timer events are set up so that a line of code won't run for a certain period of time.

CODE
var timer:Timer = new Timer(2000, 3); /*First number is how long to wait in millisecond, second number is how many times you want this code to execute.*/
timer.addEventListener(TimerEvent.TIMER, timeThis);
timer.start();

function timeThis (event:TimerEvent):void {
   //What ever code is in here will every 2000 milliseconds for 3 times.
}


Hope this helps!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.