Inactivity

Kind of class:public class
Package:org.casalib.time
Inherits from:RemovableEventDispatcher < EventDispatcher
Implements:
Version:09/06/09
Author:Aaron Clinger, Mike Creighton
Classpath:org.casalib.time.Inactivity
File last modified:Sunday, 06 September 2009, 09:04:00
Detects user inactivity by checking for a void in mouse movement and key presses.
Usage note:
Example:
  • package {
        import org.casalib.display.CasaMovieClip;
        import org.casalib.events.InactivityEvent;
        import org.casalib.time.Inactivity;
        import org.casalib.util.StageReference;
    
    
        public class MyExample extends CasaMovieClip {
            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 methods
  • start : void
    • Starts detecting inactivity.
  • stop : void
    • Stops detecting inactivity.
  • destroy : void

Constructor

Inactivity

public function Inactivity (
milliseconds:uint)

Creates an Inactivity.
Parameters:
milliseconds:
The time until a user is considered inactive.
Usage note:

Instance methods

destroy

override public function destroy (
) : void

start

public function start (
) : void

Starts detecting inactivity.
Specified by:

stop

public function stop (
) : void

Stops detecting inactivity.
Specified by: