Jump to content


Photo

Pausing


  • Please log in to reply
1 reply to this topic

#1 l3lueMage

l3lueMage

    Wanna Be Moderator

  • Publishing Betazoids
  • PipPipPipPip
  • 4,603 posts
  • Gender:Male
  • Location:Singapore

Posted 24 June 2009 - 10:53 PM

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.

#2 GRIMESD

GRIMESD

    Young Padawan

  • Members
  • Pip
  • 10 posts
  • Gender:Male
  • Location:Upstate New York
  • Interests:I have been working with web design for a few years now and recently gained much interest in flash. I am self-teaching myself AS3 while also giving tutorials to help others out with what I have learned.

Posted 19 August 2009 - 08:34 AM

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.

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!

Edited by GRIMESD, 19 August 2009 - 08:35 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users