A KeyboardEvent is dispatched in response to user input through a keyboard.

This is Starling's version of the Flash KeyboardEvent class. It contains the same properties as the Flash equivalent.

To be notified of keyboard events, add an event listener to any display object that is part of your display tree. Starling has no concept of a "Focus" like native Flash.

@see starling.display.Stage

### Hierarchy

- Event
  - KeyboardEvent

## Index

### Constructors

- constructor

### Properties

- altKey
- bubbles
- charCode
- ctrlKey
- currentTarget
- data
- keyCode
- keyLocation
- shiftKey
- target
- type
- ADDED
- ADDED_TO_STAGE
- CANCEL
- CHANGE
- CLOSE
- COMPLETE
- CONTEXT3D_CREATE
- ENTER_FRAME
- FATAL_ERROR
- IO_ERROR
- KEY_DOWN
- KEY_UP
- OPEN
- PARSE_ERROR
- READY
- REMOVED
- REMOVED_FROM_STAGE
- REMOVE_FROM_JUGGLER
- RENDER
- RESIZE
- ROOT_CREATED
- SCROLL
- SECURITY_ERROR
- SELECT
- TEXTURES_RESTORED
- TRIGGERED
- UPDATE

### Methods

- get_altKey
- get_charCode
- get_ctrlKey
- get_keyCode
- get_keyLocation
- get_shiftKey
- isDefaultPrevented
- preventDefault
- stopImmediatePropagation
- stopPropagation
- toString

## Constructors

### constructor

- new KeyboardEvent(type: string, charCode?: number, keyCode?: number, keyLocation?: number, ctrlKey?: boolean, altKey?: boolean, shiftKey?: boolean): KeyboardEvent

- Overrides Event.constructor

  - Defined in lib/starling/events/KeyboardEvent.d.ts:21

  Creates a new KeyboardEvent.

  #### Parameters

  - ##### type: string

  - ##### Optional charCode: number

  - ##### Optional keyCode: number

  - ##### Optional keyLocation: number

  - ##### Optional ctrlKey: boolean

  - ##### Optional altKey: boolean

  - ##### Optional shiftKey: boolean

  #### Returns KeyboardEvent

## Properties

### altKey

altKey: boolean

- Defined in lib/starling/events/KeyboardEvent.d.ts:54

Indicates whether the Alt key is active on Windows or Linux; indicates whether the Option key is active on Mac OS.

### bubbles

bubbles: boolean

Inherited from Event.bubbles

- Defined in lib/starling/events/Event.d.ts:94

Indicates if event will bubble.

### charCode

charCode: number

- Defined in lib/starling/events/KeyboardEvent.d.ts:40

Contains the character code of the key.

### ctrlKey

ctrlKey: boolean

- Defined in lib/starling/events/KeyboardEvent.d.ts:59

Indicates whether the Ctrl key is active on Windows or Linux; indicates whether either the Ctrl or the Command key is active on Mac OS.

### currentTarget

currentTarget: EventDispatcher

Inherited from Event.currentTarget

- Defined in lib/starling/events/Event.d.ts:100

The object the event is currently bubbling at.

### data

data: any

Inherited from Event.data

- Defined in lib/starling/events/Event.d.ts:106

Arbitrary data that is attached to the event.

### keyCode

keyCode: number

- Defined in lib/starling/events/KeyboardEvent.d.ts:44

The key code of the key.

### keyLocation

keyLocation: number

- Defined in lib/starling/events/KeyboardEvent.d.ts:49

Indicates the location of the key on the keyboard. This is useful for differentiating keys that appear more than once on a keyboard. @see Keylocation

### shiftKey

shiftKey: boolean

- Defined in lib/starling/events/KeyboardEvent.d.ts:63

Indicates whether the Shift key modifier is active (true) or inactive (false).

### target

target: EventDispatcher

Inherited from Event.target

- Defined in lib/starling/events/Event.d.ts:97

The object that dispatched the event.

### type

type: string

Inherited from Event.type

- Defined in lib/starling/events/Event.d.ts:103

A string that identifies the event.

### Static ADDED

ADDED: string

Inherited from Event.ADDED

- Defined in lib/starling/events/Event.d.ts:28

Event type for a display object that is added to a parent.

### Static ADDED_TO_STAGE

ADDED_TO_STAGE: string

Inherited from Event.ADDED_TO_STAGE

- Defined in lib/starling/events/Event.d.ts:30

Event type for a display object that is added to the stage

### Static CANCEL

CANCEL: string

Inherited from Event.CANCEL

- Defined in lib/starling/events/Event.d.ts:67

An event type to be utilized in custom events. Not used by Starling right now.

### Static CHANGE

CHANGE: string

Inherited from Event.CHANGE

- Defined in lib/starling/events/Event.d.ts:65

An event type to be utilized in custom events. Not used by Starling right now.

### Static CLOSE

CLOSE: string

Inherited from Event.CLOSE

- Defined in lib/starling/events/Event.d.ts:73

An event type to be utilized in custom events. Not used by Starling right now.

### Static COMPLETE

COMPLETE: string

Inherited from Event.COMPLETE

- Defined in lib/starling/events/Event.d.ts:42

Event type that may be used whenever something finishes.

### Static CONTEXT3D_CREATE

CONTEXT3D_CREATE: string

Inherited from Event.CONTEXT3D_CREATE

- Defined in lib/starling/events/Event.d.ts:44

Event type for a (re)created stage3D rendering context.

### Static ENTER_FRAME

ENTER_FRAME: string

Inherited from Event.ENTER_FRAME

- Defined in lib/starling/events/Event.d.ts:32

Event type for a display object that is entering a new frame.

### Static FATAL_ERROR

FATAL_ERROR: string

Inherited from Event.FATAL_ERROR

- Defined in lib/starling/events/Event.d.ts:62

Event type that is dispatched by the Starling instance when it encounters a problem from which it cannot recover, e.g. a lost device context.

### Static IO_ERROR

IO_ERROR: string

Inherited from Event.IO_ERROR

- Defined in lib/starling/events/Event.d.ts:54

Event type that is dispatched by the AssetManager when a file/url cannot be loaded.

### Static KEY_DOWN

KEY_DOWN: string

- Defined in lib/starling/events/KeyboardEvent.d.ts:21

Event type for a key that was pressed.

### Static KEY_UP

KEY_UP: string

- Defined in lib/starling/events/KeyboardEvent.d.ts:18

Event type for a key that was released.

### Static OPEN

OPEN: string

Inherited from Event.OPEN

- Defined in lib/starling/events/Event.d.ts:71

An event type to be utilized in custom events. Not used by Starling right now.

### Static PARSE_ERROR

PARSE_ERROR: string

Inherited from Event.PARSE_ERROR

- Defined in lib/starling/events/Event.d.ts:59

Event type that is dispatched by the AssetManager when an xml or json file couldn't be parsed.

### Static READY

READY: string

Inherited from Event.READY

- Defined in lib/starling/events/Event.d.ts:77

An event type to be utilized in custom events. Not used by Starling right now.

### Static REMOVED

REMOVED: string

Inherited from Event.REMOVED

- Defined in lib/starling/events/Event.d.ts:34

Event type for a display object that is removed from its parent.

### Static REMOVED_FROM_STAGE

REMOVED_FROM_STAGE: string

Inherited from Event.REMOVED_FROM_STAGE

- Defined in lib/starling/events/Event.d.ts:36

Event type for a display object that is removed from the stage.

### Static REMOVE_FROM_JUGGLER

REMOVE_FROM_JUGGLER: string

Inherited from Event.REMOVE_FROM_JUGGLER

- Defined in lib/starling/events/Event.d.ts:50

Event type for an animated object that requests to be removed from the juggler.

### Static RENDER

RENDER: string

Inherited from Event.RENDER

- Defined in lib/starling/events/Event.d.ts:46

Event type that is dispatched by the Starling instance directly before rendering.

### Static RESIZE

RESIZE: string

Inherited from Event.RESIZE

- Defined in lib/starling/events/Event.d.ts:40

Event type for a resized Flash Player.

### Static ROOT_CREATED

ROOT_CREATED: string

Inherited from Event.ROOT_CREATED

- Defined in lib/starling/events/Event.d.ts:48

Event type that indicates that the root DisplayObject has been created.

### Static SCROLL

SCROLL: string

Inherited from Event.SCROLL

- Defined in lib/starling/events/Event.d.ts:69

An event type to be utilized in custom events. Not used by Starling right now.

### Static SECURITY_ERROR

SECURITY_ERROR: string

Inherited from Event.SECURITY_ERROR

- Defined in lib/starling/events/Event.d.ts:56

Event type that is dispatched by the AssetManager when a file/url cannot be loaded.

### Static SELECT

SELECT: string

Inherited from Event.SELECT

- Defined in lib/starling/events/Event.d.ts:75

An event type to be utilized in custom events. Not used by Starling right now.

### Static TEXTURES_RESTORED

TEXTURES_RESTORED: string

Inherited from Event.TEXTURES_RESTORED

- Defined in lib/starling/events/Event.d.ts:52

Event type that is dispatched by the AssetManager after a context loss.

### Static TRIGGERED

TRIGGERED: string

Inherited from Event.TRIGGERED

- Defined in lib/starling/events/Event.d.ts:38

Event type for a triggered button.

### Static UPDATE

UPDATE: string

Inherited from Event.UPDATE

- Defined in lib/starling/events/Event.d.ts:79

An event type to be utilized in custom events. Not used by Starling right now.

## Methods

### Protected get_altKey

- get_altKey(): boolean

- - Defined in lib/starling/events/KeyboardEvent.d.ts:55

  #### Returns boolean

### Protected get_charCode

- get_charCode(): number

- - Defined in lib/starling/events/KeyboardEvent.d.ts:41

  #### Returns number

### Protected get_ctrlKey

- get_ctrlKey(): boolean

- - Defined in lib/starling/events/KeyboardEvent.d.ts:60

  #### Returns boolean

### Protected get_keyCode

- get_keyCode(): number

- - Defined in lib/starling/events/KeyboardEvent.d.ts:45

  #### Returns number

### Protected get_keyLocation

- get_keyLocation(): number

- - Defined in lib/starling/events/KeyboardEvent.d.ts:50

  #### Returns number

### Protected get_shiftKey

- get_shiftKey(): boolean

- - Defined in lib/starling/events/KeyboardEvent.d.ts:64

  #### Returns boolean

### isDefaultPrevented

- isDefaultPrevented(): boolean

- - Defined in lib/starling/events/KeyboardEvent.d.ts:35

  Checks whether the preventDefault() method has been called on the event.

  #### Returns boolean

### preventDefault

- preventDefault(): void

- - Defined in lib/starling/events/KeyboardEvent.d.ts:32

  Cancels the keyboard event's default behavior. This will be forwarded to the native flash KeyboardEvent.

  #### Returns void

### stopImmediatePropagation

- stopImmediatePropagation(): void

- Inherited from Event.stopImmediatePropagation

  - Defined in lib/starling/events/Event.d.ts:88

  Prevents any other listeners from receiving the event.

  #### Returns void

### stopPropagation

- stopPropagation(): void

- Inherited from Event.stopPropagation

  - Defined in lib/starling/events/Event.d.ts:85

  Prevents listeners at the next bubble stage from receiving the event.

  #### Returns void

### toString

- toString(): string

- Inherited from Event.toString

  - Defined in lib/starling/events/Event.d.ts:91

  Returns a description of the event, containing type and bubble information.

  #### Returns string

Generated using TypeDoc