Abdulcode

Pages

Jul 12, 2010

AS3 Snippet: FlexEvent.IDLE

A FlexEvent.IDLE event will dispatch every 100 milliseconds when there has been no keyboard or mouse activity for 1 second.

Code :
this.systemManager.addEventListener(FlexEvent.IDLE, userIdle);
private function userIdle(e:FlexEvent):void {
if(e.currentTarget.mx_internal::idleCounter == 3000){
//do something!
}
}
If the event trigger means, the control pass to the method.
In this method, we check the condition for that the system is idle for 5mins.
(Five minutes is equal to 300000 milliseconds… divided by 100 ticks and
the number we need to check against is 3000).

No comments:

Post a Comment