SetTimeout in AS3

A quick snippet to do a setTimeout() in Actionscript 3:

import flash.events.TimerEvent;
import flash.utils.Timer;

var myTimer:Timer = new Timer(1000, 1); // delay 1 second, repeats once
myTimer.start();
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerHandler);

private function timerHandler(e:TimerEvent):void
{
//_root.log(root.options[int(option)].caption);
//_root.playPlaylist();
}

Nike Shox nz

What a inspired blog!After reading your blog, I feel very exciting! Thanks for sharing so wonderful article with us. Wish you have happy everyday! Now, I will introduce you a good product, supra skylow Shoes, it's a cheap and comfortable shoes. If you want to make your everyday comfortable, you can enter into the Nike Shox nz or Nike Shox Monster website. Thank you for your visiting!

Nike Shox nz

What a inspired blog!After reading your blog, I feel very exciting! Thanks for sharing so wonderful article with us. Wish you have happy everyday! Now, I will introduce you a good product, supra skylow Shoes, it's a cheap and comfortable shoes. If you want to make your everyday comfortable, you can enter into the Nike Shox nz or Nike Shox Monster website. Thank you for your visiting!

Nike Shox nz

Usually what type of shoes does you like ? If you are longing to buying a shoes that it's suitable for you , you can go to Nike Shox nz or ke Shox Monster our website to chioce one.We are striving to bring more convenience to customers, bringing tangible benefits. Thank you for visiting!

Software is known as the

Software is known as the logical or software of a digital computer, includes all necessary software components that make possible the realization of specific tasks, as opposed to the physical components of the system, called hardware.

These software components include, among others, software-as the word processor that allows the user to perform all tasks related to editing text-o-system software such as operating system, which basically allows other programs to function properly, facilitating interaction with the physical components and other applications, also providing a user interface.
Descargar programas Gratis, Descargar SMN v5.1 ParticleDraw, Descargar MediaCoder 0.7.2.4522, Descargar Tipard WMV Video Converter, Descargar Revolt: The Decimation, Descargar Music Sorter 3.12,

setTimeout is not located in

setTimeout is not located in this code. try proof reading what you are posting.

that's ok

there is no need for a setTimeout() call in this code - this is meant to demonstrate the AS3 equivalent of the JS setTimeout() method

What if I want to pass

What if I want to pass variables with the timer? Then it's better to use AS3's setTimeOut method.

What if I want to pass

What if I want to pass variables with the timer? Then it's better to use AS3's setTimeOut method.

You would create a new Event

An untested proof-of-concept OOP solution is below.

MySpecialEvent.as:

import flash.events.TimerEvent;

package
{
  public class MySpecialEvent extends TimerEvent
  {
   
    public static var SPECIAL_TIMER_COMPLETE:String = "SPECIAL_TIMER_COMPLETE";
    public var myFirstVariable:Object;
    public var mySecondVariable:Object;
   
    public function MySpecialEvent( eType:String, var1:Object, var2:Object )
    {
      type = eType;
      myFirstVariable = var1;
      mySecondVariable = var2;
    }
  }
}

MySpecialTimer.as:

import flash.events.TimerEvent;
import flash.utils.Timer;

package
{
  public class MySpecialTimer extends Timer
  {
   
    public var myFirstVariable:Object;
    public var mySecondVariable:Object;
   
    public function MySpecialTimer( nDelay:Number, nRepeat:Number, var1:Object, var2:Object )
    {
      delay = nDelay;
      repeat = nRepeat;
      myFirstVariable = var1;
      mySecondVariable = var2;
      addEventListener( Timer_Event.TIMER_COMPLETE, raiseSpecialTimerComplete );
    }
   
    private function raiseSpecialTimerComplete( TimerEvent:e ) : void
    {
      dispatchEvent( new MySpecialEvent( MySpecialEvent.SPECIAL_TIMER_COMPLETE, myFirstVariable, mySecondVariable ) );
    }
   
  }
}

Timeline:

import flash.events.TimerEvent;
import flash.utils.Timer;

// delay 1 second, repeats once, send "BOB" and 3.1415 as variables
var myTimer:MySpecialTimer = new MySpecialTimer( 1000, 1, "BOB", 3.1415 );
myTimer.addEventListener( MySpecialEvent.SPECIAL_TIMER_COMPLETE, specialTimerHandler );
myTimer.start();

private function specialTimerHandler(e:MySpecialEvent):void
{
  trace( "Event: " + e.type );
  trace( e.myFirstVariable );
  trace( e.mySecondVariable );
}