A TouchEvent is triggered either by touch or mouse input.

In Starling, both touch events and mouse events are handled through the same class: TouchEvent. To process user input from a touch screen or the mouse, you have to register an event listener for events of the type `TouchEvent.TOUCH`. This is the only event type you need to handle; the long list of mouse event types as they are used in conventional Flash are mapped to so-called "TouchPhases" instead.

The difference between mouse input and touch input is that

- only one mouse cursor can be present at a given moment and
- only the mouse can "hover" over an object without a pressed button.

Which objects receive touch events?

In Starling, any display object receives touch events, as long as the `touchable` property of the object and its parents is enabled. There is no "InteractiveObject" class in Starling.

How to work with individual touches

The event contains a list of all touches that are currently present. Each individual touch is stored in an object of type "Touch". Since you are normally only interested in the touches that occurred on top of certain objects, you can query the event for touches with a specific target:

`touches:Vector.<Touch> = touchEvent.getTouches(this);`

This will return all touches of "this" or one of its children. When you are not using multitouch, you can also access the touch object directly, like this:

`touch:Touch = touchEvent.getTouch(this);`

@see Touch @see TouchPhase

### Hierarchy

- Event
  - TouchEvent

## Index

### Constructors

- constructor

### Properties

- bubbles
- ctrlKey
- currentTarget
- data
- shiftKey
- target
- timestamp
- touches
- type
- ADDED
- ADDED_TO_STAGE
- CANCEL
- CHANGE
- CLOSE
- COMPLETE
- CONTEXT3D_CREATE
- ENTER_FRAME
- FATAL_ERROR
- IO_ERROR
- OPEN
- PARSE_ERROR
- READY
- REMOVED
- REMOVED_FROM_STAGE
- REMOVE_FROM_JUGGLER
- RENDER
- RESIZE
- ROOT_CREATED
- SCROLL
- SECURITY_ERROR
- SELECT
- TEXTURES_RESTORED
- TOUCH
- TRIGGERED
- UPDATE

### Methods

- dispatch
- getTouch
- getTouches
- get_ctrlKey
- get_shiftKey
- get_timestamp
- get_touches
- interactsWith
- stopImmediatePropagation
- stopPropagation
- toString

## Constructors

### constructor

- new TouchEvent(type: string, touches?: Vector<Touch>, shiftKey?: boolean, ctrlKey?: boolean, bubbles?: boolean): TouchEvent

- Overrides Event.constructor

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

  Creates a new TouchEvent instance.

  #### Parameters

  - ##### type: string

  - ##### Optional touches: Vector<Touch>

  - ##### Optional shiftKey: boolean

  - ##### Optional ctrlKey: boolean

  - ##### Optional bubbles: boolean

  #### Returns TouchEvent

## Properties

### bubbles

bubbles: boolean

Inherited from Event.bubbles

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

Indicates if event will bubble.

### ctrlKey

ctrlKey: boolean

- Defined in lib/starling/events/TouchEvent.d.ts:96

Indicates if the ctrl key was pressed when the event occurred. (Mac OS: Cmd or Ctrl)

### 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.

### shiftKey

shiftKey: boolean

- Defined in lib/starling/events/TouchEvent.d.ts:92

Indicates if the shift key was pressed when the event occurred.

### target

target: EventDispatcher

Inherited from Event.target

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

The object that dispatched the event.

### timestamp

timestamp: number

- Defined in lib/starling/events/TouchEvent.d.ts:84

The time the event occurred (in seconds since application launch).

### touches

touches: Vector<Touch>

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

All touches that are currently available.

### 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 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 TOUCH

TOUCH: string

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

Event type for touch or mouse input.

### 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

### Private dispatch

- dispatch(chain: Vector<EventDispatcher>): void

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

  #### Parameters

  - ##### chain: Vector<EventDispatcher>

  #### Returns void

### getTouch

- getTouch(target: DisplayObject, phase?: string, id?: number): Touch

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

  Returns a touch that originated over a certain target.

  #### Parameters

  - ##### target: DisplayObject

    The object that was touched; may also be a parent of the actual touch-target.

  - ##### Optional phase: string

    The phase the touch must be in, or null if you don't care.

  - ##### Optional id: number

    The ID of the requested touch, or -1 if you don't care.

  #### Returns Touch

### getTouches

- getTouches(target: DisplayObject, phase?: string, out?: Vector<Touch>): Vector<Touch>

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

  Returns a list of touches that originated over a certain target. If you pass an `out`-vector, the touches will be added to this vector instead of creating a new object.

  #### Parameters

  - ##### target: DisplayObject

  - ##### Optional phase: string

  - ##### Optional out: Vector<Touch>

  #### Returns Vector<Touch>

### Protected get_ctrlKey

- get_ctrlKey(): boolean

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

  #### Returns boolean

### Protected get_shiftKey

- get_shiftKey(): boolean

- - Defined in lib/starling/events/TouchEvent.d.ts:93

  #### Returns boolean

### Protected get_timestamp

- get_timestamp(): number

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

  #### Returns number

### Protected get_touches

- get_touches(): Vector<Touch>

- - Defined in lib/starling/events/TouchEvent.d.ts:89

  #### Returns Vector<Touch>

### interactsWith

- interactsWith(target: DisplayObject): boolean

- - Defined in lib/starling/events/TouchEvent.d.ts:72

  Indicates if a target is currently being touched or hovered over.

  #### Parameters

  - ##### target: DisplayObject

  #### Returns boolean

### 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