Packageorg.papervision3d.core.utils.virtualmouse
Classpublic class VirtualMouse
InheritanceVirtualMouse Inheritance flash.events.EventDispatcher

The VirtualMouse class is used to create a programmatic version of the users mouse that can be moved about the Flash player stage firing off mouse events of the display objects it interacts with. This can allow you to simulate interaction with buttons and movie clips through ActionScript.
Handled events include: Event.MOUSE_LEAVE, MouseEvent.MOUSE_MOVE, MouseEvent.MOUSE_OUT, MouseEvent.ROLL_OUT, MouseEvent.MOUSE_OVER, MouseEvent.ROLL_OVER, MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_UP. MouseEvent.CLICK, and, MouseEvent.DOUBLE_CLICK. Along with dispatching those events for their respective targets, the VirtualMouse instance will also dispatch the event on itself allowing to capture which events are being fired by the virtual mouse. The last event fired can also be referenced in the lastEvent property.
VirtualMouse mouse cannot: activate states of SimpleButton instances, change object focus, handle mouseWheel related events, change the system's cursor location, or spoof the location of the mouseX and mouseY properties (which some components rely on).



Public Properties
 PropertyDefined by
  container : Sprite
VirtualMouse
  lastEvent : Event
[read-only] The last event dispatched by the VirtualMouse instance.
VirtualMouse
  mouseIsDown : Boolean
[read-only] True if the virtual mouse is being pressed, false if not.
VirtualMouse
  stage : Stage
A reference to the Stage instance.
VirtualMouse
  useNativeEvents : Boolean
Determines if the events dispatched by the VirtualMouse instance are IVirualMouseEvent Events (wrapping Event and MouseEvent) or events of the native Event and MouseEvent type.
VirtualMouse
  x : Number
The x location of the virtual mouse.
VirtualMouse
  y : Number
The y location of the virtual mouse.
VirtualMouse
Public Methods
 MethodDefined by
  
VirtualMouse(stage:Stage = null, container:Sprite = null, startX:Number = 0, startY:Number = 0)
Initializes a new VirtualMouse instance.
VirtualMouse
  
click():void
Simulates a click of the left mouse button (press and release)
VirtualMouse
  
disableEvent(type:String):void
Allows you to disable an event by type preventing the virtual mouse from dispatching that event during an update.
VirtualMouse
  
doubleClick():void
Simulates a double-click of the left mouse button (press and release twice).
VirtualMouse
  
enableEvent(type:String):void
Re-enables an event disabled with disableEvent.
VirtualMouse
  
VirtualMouse
  
getLocation():Point
Returns the location (x and y) of the current VirtualMouse instance.
VirtualMouse
  
ignore(instance:DisplayObject):void
Ignores a display object preventing that object from recieving events from the virtual mouse.
VirtualMouse
  
lock():void
Locks the current VirtualMouse instance preventing updates from being made as properties change within the instance.
VirtualMouse
  
press():void
Simulates the pressing of the left mouse button.
VirtualMouse
  
release():void
Simulates the release of the left mouse button.
VirtualMouse
  
setLocation(a:*, b:* = null):void
Sets the location (x and y) of the current VirtualMouse instance.
VirtualMouse
  
unignore(instance:DisplayObject):void
Removes an instance from the ignore list defined by ignore().
VirtualMouse
  
unlock():void
Unlocks the current VirtualMouse instance allowing updates to be made for the dispatching of virtual mouse events.
VirtualMouse
  
update():void
Updates the VirtualMouse instance's state to reflect a change in the virtual mouse.
VirtualMouse
Events
 EventSummaryDefined by
   Dispatched when the virtual mouse fires an MouseEvent.CLICK event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.DOUBLE_CLICK event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.MOUSE_DOWN event.VirtualMouse
   Dispatched when the virtual mouse fires an Event.MOUSE_LEAVE event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.MOUSE_MOVE event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.MOUSE_OUT event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.MOUSE_OVER event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.MOUSE_UP event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.ROLL_OUT event.VirtualMouse
   Dispatched when the virtual mouse fires an MouseEvent.ROLL_OVER event.VirtualMouse
   Dispatched when the virtual mouse state is updated.VirtualMouse
Public Constants
 ConstantDefined by
  UPDATE : String = "update"
[static]
VirtualMouse
Property detail
containerproperty
container:Sprite  [read-write]Implementation
    public function get container():Sprite
    public function set container(value:Sprite):void
lastEventproperty 
lastEvent:Event  [read-only]

The last event dispatched by the VirtualMouse instance. This can be useful for preventing event recursion if performing VirtualMouse operations within MouseEvent handlers.

Implementation
    public function get lastEvent():Event
mouseIsDownproperty 
mouseIsDown:Boolean  [read-only]

True if the virtual mouse is being pressed, false if not. The mouse is down for the virtual mouse if press() was called.

Implementation
    public function get mouseIsDown():Boolean

See also

press()
release()
stageproperty 
stage:Stage  [read-write]

A reference to the Stage instance. This reference needs to be passed to the VirtualMouse instance either in its constructor or through assigning it's stage property. Without a valid reference to the stage, the virtual mouse will not function.

Implementation
    public function get stage():Stage
    public function set stage(value:Stage):void

See also

VirtualMouse()
useNativeEventsproperty 
useNativeEvents:Boolean  [read-write]

Determines if the events dispatched by the VirtualMouse instance are IVirualMouseEvent Events (wrapping Event and MouseEvent) or events of the native Event and MouseEvent type. When using non-native events, you can check to see if the events originated from VirtualMouse by seeing if the events are of the type IVirualMouseEvent.

Implementation
    public function get useNativeEvents():Boolean
    public function set useNativeEvents(value:Boolean):void

See also

lastEvent
xproperty 
x:Number  [read-write]

The x location of the virtual mouse. If you are setting both the x and y properties of the virtual mouse at the same time, you would probably want to lock the VirtualMouse instance to prevent additional events from firing.

Implementation
    public function get x():Number
    public function set x(value:Number):void

See also

lock
unlock
y
setLocation()
getLocation()
yproperty 
y:Number  [read-write]

The y location of the virtual mouse. If you are setting both the x and y properties of the virtual mouse at the same time, you would probably want to lock the VirtualMouse instance to prevent additional events from firing.

Implementation
    public function get y():Number
    public function set y(value:Number):void

See also

lock
unlock
x
setLocation()
getLocation()
Constructor detail
VirtualMouse()constructor
public function VirtualMouse(stage:Stage = null, container:Sprite = null, startX:Number = 0, startY:Number = 0)

Initializes a new VirtualMouse instance.

Parameters
stage:Stage (default = null) — A reference to the stage instance.
 
container:Sprite (default = null) — The initial x location of the virtual mouse.
 
startX:Number (default = 0) — The initial y location of the virtual mouse.
 
startY:Number (default = 0)
Method detail
click()method
public function click():void

Simulates a click of the left mouse button (press and release)

See also

press()
release()
click()
doubleClick()
disableEvent()method 
public function disableEvent(type:String):void

Allows you to disable an event by type preventing the virtual mouse from dispatching that event during an update.

Parameters
type:String — The type for the event to disable, e.g. MouseEvent.CLICK

See also

enableEvent()
doubleClick()method 
public function doubleClick():void

Simulates a double-click of the left mouse button (press and release twice). Calling this command is the only way to simulate a double-click for the virtual mouse. Calling press() and release() or click() is rapid succession will not invoke a double-click event. The double-click event will also only fire for an instance if it's doubleClickEnabled property is set to true.

See also

click()
enableEvent()method 
public function enableEvent(type:String):void

Re-enables an event disabled with disableEvent.

Parameters
type:String — The type for the event to enable, e.g. MouseEvent.CLICK

See also

disableEvent()
exitContainer()method 
public function exitContainer():void
getLocation()method 
public function getLocation():Point

Returns the location (x and y) of the current VirtualMouse instance. The location of the virtual mouse is based in the global coordinate space.

Returns
Point — A Point instance representing the location of the virtual mouse in global coordinate space.

See also

x
y
setLocation()
ignore()method 
public function ignore(instance:DisplayObject):void

Ignores a display object preventing that object from recieving events from the virtual mouse. This is useful for instances used for cursors which may always be under the virtual mouse's location.

Parameters
instance:DisplayObject — A reference to the DisplayObject instance to ignore.

See also

unignore()
lock()method 
public function lock():void

Locks the current VirtualMouse instance preventing updates from being made as properties change within the instance. To release and allow an update, call unlock().

See also

lock()
update()
press()method 
public function press():void

Simulates the pressing of the left mouse button. To release the mouse button, use release().

See also

release()
click()
release()method 
public function release():void

Simulates the release of the left mouse button. This method has no effect unless press() was called first.

See also

press()
click()
setLocation()method 
public function setLocation(a:*, b:* = null):void

Sets the location (x and y) of the current VirtualMouse instance. There are two ways to call setLocation, either passing in a single Point instance, or by passing in two Number instances representing x and y coordinates. The location of the virtual mouse is based in the global coordinate space.

Parameters
a:* — A Point instance or x Number value.
 
b:* (default = null) — A y Number value if a is a Number.

See also

x
y
getLocation()
unignore()method 
public function unignore(instance:DisplayObject):void

Removes an instance from the ignore list defined by ignore(). When an ingored object is passed into unignore(), it will be able to receive events from the virtual mouse.

Parameters
instance:DisplayObject — A reference to the DisplayObject instance to unignore.

See also

ignore()
unlock()method 
public function unlock():void

Unlocks the current VirtualMouse instance allowing updates to be made for the dispatching of virtual mouse events. After unlocking the instance, it will update and additional calls to press(), release(), or changing the location of the virtual mouse will also invoke updates.

See also

lock()
update()
update()method 
public function update():void

Updates the VirtualMouse instance's state to reflect a change in the virtual mouse. Within this method all events will be dispatched. update() is called any time a VirtualMouse property is changed unless lock() was used to lock the instance. update() will then not be called until unlock() is used to unlock the instance. Typically you would never call update() directly; it is called automatically by the VirtualMouse class. Calling update() manually will override lock(). Whenever update() is called, the UPDATE event is dispatched.

See also

lock()
unlock()
Event detail
clickevent 
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.CLICK event.

doubleClickevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.DOUBLE_CLICK event.

mouseDownevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.MOUSE_DOWN event.

mouseLeaveevent  
Event object type: flash.events.Event

Dispatched when the virtual mouse fires an Event.MOUSE_LEAVE event.

mouseMoveevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.MOUSE_MOVE event.

mouseOutevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.MOUSE_OUT event.

mouseOverevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.MOUSE_OVER event.

mouseUpevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.MOUSE_UP event.

rollOutevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.ROLL_OUT event.

rollOverevent  
Event object type: flash.events.MouseEvent

Dispatched when the virtual mouse fires an MouseEvent.ROLL_OVER event.

updateevent  
Event object type: flash.events.Event

Dispatched when the virtual mouse state is updated.

Constant detail
UPDATEconstant
public static const UPDATE:String = "update"