Disable Flex App on TimeOut.

February 29, 2008

First define a Timer with the specified timeinterval.

var mTimer:Timer=new Timer(3000);  –> here 3 secs.

Now add eventlisteners as Timercomplete.

mTimer.addEventListener(TimerEvent.TIMER_COMPLETE,Comple);

start the Timer.At a needed location.

mTimer.start();

Now define the function as called from the EventListeners.[i.e Comple].

private function Comple(e:TimerEvent):void
{
//Disable the app with the line of code below.

this.enabled = false;

}

This will Disable the App after 3 secs.

There is a clear post on use of Timer below this post, read it to know the basics of the Timer.

Enjoy the code !. The below snashot is the disabled Flex app.

Disabled Flex App.

Advertisements