Packagenet.flashpunk.utils
Classpublic class Input
InheritanceInput Inheritance Object

Static class updated by Engine. Use for defining and checking keyboard/mouse input.



Public Properties
 PropertyDefined By
  keyString : String
[static] An updated string containing the last 100 characters pressed on the keyboard.
Input
  lastKey : int
[static] The last key pressed.
Input
  mouseCursor : String
[static] The mouse cursor.
Input
  mouseDown : Boolean = false
[static] If the mouse button is down.
Input
  mouseFlashX : int
[static] [read-only] The absolute mouse x position on the screen (unscaled).
Input
  mouseFlashY : int
[static] [read-only] The absolute mouse y position on the screen (unscaled).
Input
  mousePressed : Boolean = false
[static] If the mouse button was pressed this frame.
Input
  mouseReleased : Boolean = false
[static] If the mouse button was released this frame.
Input
  mouseUp : Boolean = true
[static] If the mouse button is up.
Input
  mouseWheel : Boolean = false
[static] If the mouse wheel was moved this frame.
Input
  mouseWheelDelta : int
[static] [read-only] If the mouse wheel was moved this frame, this was the delta.
Input
  mouseX : int
[static] [read-only] X position of the mouse on the screen.
Input
  mouseY : int
[static] [read-only] Y position of the mouse on the screen.
Input
Public Methods
 MethodDefined By
  
check(input:*):Boolean
[static] If the input or key is held down.
Input
  
clear():void
[static] Clears all input states.
Input
  
define(name:String, ... keys):void
[static] Defines a new input.
Input
  
keys(name:String):Vector.<int>
[static] Returns the keys mapped to the input name.
Input
  
pressed(input:*):Boolean
[static] If the input or key was pressed this frame.
Input
  
released(input:*):Boolean
[static] If the input or key was released this frame.
Input
Property Detail
keyStringproperty
public static var keyString:String

An updated string containing the last 100 characters pressed on the keyboard. Useful for creating text input fields, such as highscore entries, etc.

lastKeyproperty 
public static var lastKey:int

The last key pressed.

mouseCursorproperty 
public static var mouseCursor:String

The mouse cursor. Set to "hide" to hide the cursor. See the flash.ui.MouseCursor class for a list of all other possible values. Common values: "auto" or "button".

mouseDownproperty 
public static var mouseDown:Boolean = false

If the mouse button is down.

mouseFlashXproperty 
mouseFlashX:int  [read-only]

The absolute mouse x position on the screen (unscaled).


Implementation
    public static function get mouseFlashX():int
mouseFlashYproperty 
mouseFlashY:int  [read-only]

The absolute mouse y position on the screen (unscaled).


Implementation
    public static function get mouseFlashY():int
mousePressedproperty 
public static var mousePressed:Boolean = false

If the mouse button was pressed this frame.

mouseReleasedproperty 
public static var mouseReleased:Boolean = false

If the mouse button was released this frame.

mouseUpproperty 
public static var mouseUp:Boolean = true

If the mouse button is up.

mouseWheelproperty 
public static var mouseWheel:Boolean = false

If the mouse wheel was moved this frame.

mouseWheelDeltaproperty 
mouseWheelDelta:int  [read-only]

If the mouse wheel was moved this frame, this was the delta.


Implementation
    public static function get mouseWheelDelta():int
mouseXproperty 
mouseX:int  [read-only]

X position of the mouse on the screen.


Implementation
    public static function get mouseX():int
mouseYproperty 
mouseY:int  [read-only]

Y position of the mouse on the screen.


Implementation
    public static function get mouseY():int
Method Detail
check()method
public static function check(input:*):Boolean

If the input or key is held down.

Parameters

input:* — An input name or key to check for.

Returns
Boolean — True or false.
clear()method 
public static function clear():void

Clears all input states.

define()method 
public static function define(name:String, ... keys):void

Defines a new input.

Parameters

name:String — String to map the input to.
 
... keys — The keys to use for the Input.

keys()method 
public static function keys(name:String):Vector.<int>

Returns the keys mapped to the input name.

Parameters

name:String — The input name.

Returns
Vector.<int> — A Vector of keys.
pressed()method 
public static function pressed(input:*):Boolean

If the input or key was pressed this frame.

Parameters

input:* — An input name or key to check for.

Returns
Boolean — True or false.
released()method 
public static function released(input:*):Boolean

If the input or key was released this frame.

Parameters

input:* — An input name or key to check for.

Returns
Boolean — True or false.