Constructors

Properties

Methods

MouseIdleMonitor class

MouseIdleMonitor

extends EventDispatcher

 

 

Overview

Author

Matt Przybylski [http://www.reintroducing.com]

Version

1.0

Description

A small utility class that allows you to see if a user has been inactive with the mouse. The class will dispatch a custom MouseIdleMonitorEvent with a params object that contains the time the user has been idle, in milliseconds.

Constructors

 

MouseIdleMonitor

Usage

public function MouseIdleMonitor($stage:Stage, $inactiveTime:int = 1000):void

Description

Creates an instance of hte MouseIdleMonitor class.

The class will dispatch two events:

  • MouseIdleMonitorEvent.MOUSE_ACTIVE: Dispatched when the mouse becomes active, repeatedly on MOUSE_MOVE
  • MouseIdleMonitorEvent.MOUSE_IDLE: Dispatched when the mouse becomes inactive, params object holds idle time ("time")

Parameters

$stage
The stage object to use for the mouse tracking
$inactiveTime
The time, in milliseconds, to check if the user is active or not (default: 1000)

Properties

 

isMouseActive

Usage

public function get isMouseActive():Boolean

Description

Returns a boolean value that specifies if the mouse is active or not.
 

idleTime

Usage

public function get idleTime():int

Description

Returns an integer representing the amount of time the user's mouse has been inactive, in milliseconds

Methods

 

start

Usage

public function start():void

Description

Starts the MouseIdleMonitor and allows it to check for mouse inactivity.

Returns

void
 

stop

Usage

public function stop():void

Description

Stops the MouseIdleMonitor from checking for mouse inactivity.

Returns

void
 

onMouseMove

Usage

private function onMouseMove($evt:MouseEvent):void

Description

Reset the timer if the mouse moves, user is active.

Returns

Nothing
 

onTimer

Usage

private function onTimer($evt:TimerEvent):void

Description

Runs if the user is inactive, sets the idle time.

Returns

Nothing