Inactivity
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.time |
| Inherits from: | RemovableEventDispatcher < EventDispatcher |
| Implements: | |
| Version: | 10/26/08 |
| Author: | Aaron Clinger, Mike Creighton |
| Classpath: | org.casalib.time.Inactivity |
| File last modified: | Monday, 01 December 2008, 11:16:36 |
Detects user inactivity by checking for a void in mouse movement and key presses.
Usage note:
- You must first initialize StageReference before using this class.
Example:
-
package { import flash.display.MovieClip; import org.casalib.time.Inactivity; import org.casalib.util.StageReference; import org.casalib.events.InactivityEvent; public class MyExample extends MovieClip { protected var _inactivity:Inactivity; public function MyExample() { super(); StageReference.setStage(this.stage); this._inactivity = new Inactivity(3000); this._inactivity.addEventListener(InactivityEvent.INACTIVE, this.onUserInactive); this._inactivity.addEventListener(InactivityEvent.ACTIVATED, this.onUserActivated); this._inactivity.start(); } public function onUserInactive(e:InactivityEvent):void { trace("User inactive for " + e.milliseconds + " milliseconds."); } public function onUserActivated(e:InactivityEvent):void { trace("User active after being inactive for " + e.milliseconds + " milliseconds."); } } }
Events broadcasted to listeners:
- InactivityEvent with type:
INACTIVE- Dispatched when the user is inactive. - InactivityEvent with type:
ACTIVATED- Dispatched when the user becomes active after a period of inactivity.
Summary
Constructor
- Inactivity (milliseconds:uint)
- Creates an Inactivity.
Instance properties
Instance properties inherited from RemovableEventDispatcher
Instance methods
Instance methods inherited from RemovableEventDispatcher
Constructor
Inactivity
public function Inactivity (
milliseconds:uint)
Creates an Inactivity.
Parameters:
milliseconds:
The time until a user is considered inactive.
Usage note:
- You must first initialize StageReference before using this class.