Packageorg.flixel.data
Classpublic class FlxMouse

This class helps contain and track the mouse pointer in your game. Automatically accounts for parallax scrolling, etc.



Public Properties
 PropertyDefined by
  cursor : FlxSprite
Graphical representation of the mouse pointer.
FlxMouse
  screenX : int
Current X position of the mouse pointer on the screen.
FlxMouse
  screenY : int
Current Y position of the mouse pointer on the screen.
FlxMouse
  wheel : int
Current "delta" value of mouse wheel.
FlxMouse
  x : int
Current X position of the mouse pointer in the game world.
FlxMouse
  y : int
Current Y position of the mouse pointer in the game world.
FlxMouse
Protected Properties
 PropertyDefined by
  _current : int
Helper variable for tracking whether the mouse was just pressed or just released.
FlxMouse
  ImgDefaultCursor : Class
FlxMouse
  _last : int
Helper variable for tracking whether the mouse was just pressed or just released.
FlxMouse
  _out : Boolean
Helper for mouse visibility.
FlxMouse
Public Methods
 MethodDefined by
  
Constructor.
FlxMouse
  
handleMouseDown(event:MouseEvent):void
Event handler so FlxGame can update the mouse.
FlxMouse
  
handleMouseOut(event:MouseEvent):void
Event handler so FlxGame can update the mouse.
FlxMouse
  
handleMouseOver(event:MouseEvent):void
Event handler so FlxGame can update the mouse.
FlxMouse
  
handleMouseUp(event:MouseEvent):void
Event handler so FlxGame can update the mouse.
FlxMouse
  
handleMouseWheel(event:MouseEvent):void
Event handler so FlxGame can update the mouse.
FlxMouse
  
hide():void
Hides the mouse cursor
FlxMouse
  
justPressed():Boolean
Check to see if the mouse was just pressed.
FlxMouse
  
justReleased():Boolean
Check to see if the mouse was just released.
FlxMouse
  
load(Graphic:Class, XOffset:int = 0, YOffset:int = 0):void
Load a new mouse cursor graphic
FlxMouse
  
pressed():Boolean
Check to see if the mouse is pressed.
FlxMouse
  
reset():void
Resets the just pressed/just released flags and sets mouse to not pressed.
FlxMouse
  
show(Graphic:Class = null, XOffset:int = 0, YOffset:int = 0):void
Either show an existing cursor or load a new one.
FlxMouse
  
unload():void
Unload the current cursor graphic.
FlxMouse
  
update(X:int, Y:int, XScroll:Number, YScroll:Number):void
Called by the internal game loop to update the mouse pointer's position in the game world.
FlxMouse
Property detail
_currentproperty
protected var _current:int

Helper variable for tracking whether the mouse was just pressed or just released.

cursorproperty 
public var cursor:FlxSprite

Graphical representation of the mouse pointer.

ImgDefaultCursorproperty 
protected var ImgDefaultCursor:Class
_lastproperty 
protected var _last:int

Helper variable for tracking whether the mouse was just pressed or just released.

_outproperty 
protected var _out:Boolean

Helper for mouse visibility.

screenXproperty 
public var screenX:int

Current X position of the mouse pointer on the screen.

screenYproperty 
public var screenY:int

Current Y position of the mouse pointer on the screen.

wheelproperty 
public var wheel:int

Current "delta" value of mouse wheel. If the wheel was just scrolled up, it will have a positive value. If it was just scrolled down, it will have a negative value. If it wasn't just scroll this frame, it will be 0.

xproperty 
public var x:int

Current X position of the mouse pointer in the game world.

yproperty 
public var y:int

Current Y position of the mouse pointer in the game world.

Constructor detail
FlxMouse()constructor
public function FlxMouse()

Constructor.

Method detail
handleMouseDown()method
public function handleMouseDown(event:MouseEvent):void

Event handler so FlxGame can update the mouse.

Parameters
event:MouseEvent — A MouseEvent object.
handleMouseOut()method 
public function handleMouseOut(event:MouseEvent):void

Event handler so FlxGame can update the mouse.

Parameters
event:MouseEvent — A MouseEvent object.
handleMouseOver()method 
public function handleMouseOver(event:MouseEvent):void

Event handler so FlxGame can update the mouse.

Parameters
event:MouseEvent — A MouseEvent object.
handleMouseUp()method 
public function handleMouseUp(event:MouseEvent):void

Event handler so FlxGame can update the mouse.

Parameters
event:MouseEvent — A MouseEvent object.
handleMouseWheel()method 
public function handleMouseWheel(event:MouseEvent):void

Event handler so FlxGame can update the mouse.

Parameters
event:MouseEvent — A MouseEvent object.
hide()method 
public function hide():void

Hides the mouse cursor

justPressed()method 
public function justPressed():Boolean

Check to see if the mouse was just pressed.

Returns
Boolean — Whether the mouse was just pressed.
justReleased()method 
public function justReleased():Boolean

Check to see if the mouse was just released.

Returns
Boolean — Whether the mouse was just released.
load()method 
public function load(Graphic:Class, XOffset:int = 0, YOffset:int = 0):void

Load a new mouse cursor graphic

Parameters
Graphic:Class — The image you want to use for the cursor.
 
XOffset:int (default = 0) — The number of pixels between the mouse's screen position and the graphic's top left corner.
 
YOffset:int (default = 0) — The number of pixels between the mouse's screen position and the graphic's top left corner.
pressed()method 
public function pressed():Boolean

Check to see if the mouse is pressed.

Returns
Boolean — Whether the mouse is pressed.
reset()method 
public function reset():void

Resets the just pressed/just released flags and sets mouse to not pressed.

show()method 
public function show(Graphic:Class = null, XOffset:int = 0, YOffset:int = 0):void

Either show an existing cursor or load a new one.

Parameters
Graphic:Class (default = null) — The image you want to use for the cursor.
 
XOffset:int (default = 0) — The number of pixels between the mouse's screen position and the graphic's top left corner.
 
YOffset:int (default = 0) — The number of pixels between the mouse's screen position and the graphic's top left corner.
unload()method 
public function unload():void

Unload the current cursor graphic. If the current cursor is visible, then the default system cursor is loaded up to replace the old one.

update()method 
public function update(X:int, Y:int, XScroll:Number, YScroll:Number):void

Called by the internal game loop to update the mouse pointer's position in the game world. Also updates the just pressed/just released flags.

Parameters
X:int — The current X position of the mouse in the window.
 
Y:int — The current Y position of the mouse in the window.
 
XScroll:Number — The amount the game world has scrolled horizontally.
 
YScroll:Number — The amount the game world has scrolled vertically.