IdleSun's Weblog

September 30, 2008

Wanna sleep in Flex?

Filed under: Flex — idlesun @ 10:58 pm

There is no sleep or delay function in ActionScript. Like JavaScript, you can use setTimeout() instead like this:

function trigger():void { setTimeout(doIt, 1000); }
function doIt():void    {"done!"); }

Once you link the trigger() function to any event such as ‘click’, when the event happens alert box will show up after 1 sec.

There is also setInterval() and clearlnterval() functions you can use for repetition. However, it is recommended to use flash.utils.Timer class in that case.


1 Comment »

  1. Your style is unique compared to other folks I
    have read stuff from. Thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this

    Comment by treatment — March 23, 2013 @ 6:54 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: