The IdleTimer is a Flash MX 2004 component that dispatches a "timeup" event when a user has not interacted with the movie for an author settable length of time.
Demo:
Methods
Start()
Starts the timer.
Reset()
Reset the timer.
Stop()
Stops the timer.
getTimeLeft()
Returns the time left in milliseconds before firing the timeup event.
Inherits all methods from UIObject and UIComponent.
Properties
verbose
Whether the component should display trace messages.
visible
Whether the component should be seen.
Inherits all properties from UIObject and UIComponent.
Events
timeup
Broadcast when the duration time has elapsed and a user has not interacted with the movie.
Inherits all events from UIObject and UIComponent.
Usage
Drag an IdleTimer component onto the Stage and give it an instance name of cpIdleTimer.
Select Frame 1 of the Timeline and, in the Actions panel, enter the following code below the data provider code:
var oListener:Object = new Object();
// KeyDown event listener added manually
// only needed to respond to key events
var IdleTimerKeyDown = function() {
_root.cpIdleTimer.Reset();
}
oListener.onKeyDown = IdleTimerKeyDown;
Key.addListener(oListener);
oListener.timeup = function(oEvent:Object):Void {
trace("time ran out");
};
cpIdleTimer.addEventListener("timeup", oListener);
cpIdleTimer.Start(10000);
Select Control > Test Movie to test the IdleTimer component.