A Touch object contains information about the presence or movement of a finger or the mouse on the screen.

You receive objects of this type from a TouchEvent. When such an event is triggered, you can query it for all touches that are currently present on the screen. One touch object contains information about a single touch; it always transitions through a series of TouchPhases. Have a look at the TouchPhase class for more information.

The position of a touch

You can get the current and previous position in stage coordinates with the corresponding properties. However, you'll want to have the position in a different coordinate system most of the time. For this reason, there are methods that convert the current and previous touches into the local coordinate system of any object.

@see TouchEvent @see TouchPhase

### Hierarchy

- Touch

## Index

### Constructors

- constructor

### Properties

- cancelled
- globalX
- globalY
- height
- id
- phase
- pressure
- previousGlobalX
- previousGlobalY
- tapCount
- target
- timestamp
- width

### Methods

- clone
- getLocation
- getMovement
- getPreviousLocation
- get_cancelled
- get_globalX
- get_globalY
- get_height
- get_id
- get_phase
- get_pressure
- get_previousGlobalX
- get_previousGlobalY
- get_tapCount
- get_target
- get_timestamp
- get_width
- isTouching
- set_cancelled
- set_globalX
- set_globalY
- set_height
- set_phase
- set_pressure
- set_tapCount
- set_target
- set_timestamp
- set_width
- toString

## Constructors

### constructor

- new Touch(id: number): Touch

- - Defined in lib/starling/events/Touch.d.ts:27

  Creates a new Touch object.

  #### Parameters

  - ##### id: number

  #### Returns Touch

## Properties

### cancelled

cancelled: boolean

- Defined in lib/starling/events/Touch.d.ts:122

Indicates if the touch has been cancelled, which may happen when the app moves into the background ('Event.DEACTIVATE'). @default false

### globalX

globalX: number

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

The x-position of the touch in stage coordinates. If you change this value, the previous one will be moved to "previousGlobalX".

### globalY

globalY: number

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

The y-position of the touch in stage coordinates. If you change this value, the previous one will be moved to "previousGlobalY".

### height

height: number

- Defined in lib/starling/events/Touch.d.ts:116

Height of the contact area. If the device does not support detecting the pressure, the value is 1.0.

### id

id: number

- Defined in lib/starling/events/Touch.d.ts:58

The identifier of a touch. '0' for mouse events, an increasing number for touches.

### phase

phase: string

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

The current phase the touch is in. @see TouchPhase

### pressure

pressure: number

- Defined in lib/starling/events/Touch.d.ts:104

A value between 0.0 and 1.0 indicating force of the contact with the device. If the device does not support detecting the pressure, the value is 1.0.

### previousGlobalX

previousGlobalX: number

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

The previous x-position of the touch in stage coordinates.

### previousGlobalY

previousGlobalY: number

- Defined in lib/starling/events/Touch.d.ts:66

The previous y-position of the touch in stage coordinates.

### tapCount

tapCount: number

- Defined in lib/starling/events/Touch.d.ts:83

The number of taps the finger made in a short amount of time. Use this to detect double-taps / double-clicks, etc.

### target

target: DisplayObject

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

The display object at which the touch occurred.

### timestamp

timestamp: number

- Defined in lib/starling/events/Touch.d.ts:98

The moment the touch occurred (in seconds since application start).

### width

width: number

- Defined in lib/starling/events/Touch.d.ts:110

Width of the contact area. If the device does not support detecting the pressure, the value is 1.0.

## Methods

### clone

- clone(): Touch

- - Defined in lib/starling/events/Touch.d.ts:53

  Creates a clone of the Touch object.

  #### Returns Touch

### getLocation

- getLocation(space: DisplayObject, out?: Point): Point

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

  Converts the current location of a touch to the local coordinate system of a display object. If you pass an `out`-point, the result will be stored in this point instead of creating a new object.

  #### Parameters

  - ##### space: DisplayObject

  - ##### Optional out: Point

  #### Returns Point

### getMovement

- getMovement(space: DisplayObject, out?: Point): Point

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

  Returns the movement of the touch between the current and previous location. If you pass an `out`-point, the result will be stored in this point instead of creating a new object.

  #### Parameters

  - ##### space: DisplayObject

  - ##### Optional out: Point

  #### Returns Point

### getPreviousLocation

- getPreviousLocation(space: DisplayObject, out?: Point): Point

- - Defined in lib/starling/events/Touch.d.ts:39

  Converts the previous location of a touch to the local coordinate system of a display object. If you pass an `out`-point, the result will be stored in this point instead of creating a new object.

  #### Parameters

  - ##### space: DisplayObject

  - ##### Optional out: Point

  #### Returns Point

### Protected get_cancelled

- get_cancelled(): boolean

- - Defined in lib/starling/events/Touch.d.ts:123

  #### Returns boolean

### Protected get_globalX

- get_globalX(): number

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

  #### Returns number

### Protected get_globalY

- get_globalY(): number

- - Defined in lib/starling/events/Touch.d.ts:78

  #### Returns number

### Protected get_height

- get_height(): number

- - Defined in lib/starling/events/Touch.d.ts:117

  #### Returns number

### Protected get_id

- get_id(): number

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

  #### Returns number

### Protected get_phase

- get_phase(): string

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

  #### Returns string

### Protected get_pressure

- get_pressure(): number

- - Defined in lib/starling/events/Touch.d.ts:105

  #### Returns number

### Protected get_previousGlobalX

- get_previousGlobalX(): number

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

  #### Returns number

### Protected get_previousGlobalY

- get_previousGlobalY(): number

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

  #### Returns number

### Protected get_tapCount

- get_tapCount(): number

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

  #### Returns number

### Protected get_target

- get_target(): DisplayObject

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

  #### Returns DisplayObject

### Protected get_timestamp

- get_timestamp(): number

- - Defined in lib/starling/events/Touch.d.ts:99

  #### Returns number

### Protected get_width

- get_width(): number

- - Defined in lib/starling/events/Touch.d.ts:111

  #### Returns number

### isTouching

- isTouching(target: DisplayObject): boolean

- - Defined in lib/starling/events/Touch.d.ts:47

  Indicates if the target or one of its children is touched.

  #### Parameters

  - ##### target: DisplayObject

  #### Returns boolean

### Protected set_cancelled

- set_cancelled(value: boolean): boolean

- - Defined in lib/starling/events/Touch.d.ts:124

  #### Parameters

  - ##### value: boolean

  #### Returns boolean

### Protected set_globalX

- set_globalX(value: number): number

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

  #### Parameters

  - ##### value: number

  #### Returns number

### Protected set_globalY

- set_globalY(value: number): number

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

  #### Parameters

  - ##### value: number

  #### Returns number

### Protected set_height

- set_height(value: number): number

- - Defined in lib/starling/events/Touch.d.ts:118

  #### Parameters

  - ##### value: number

  #### Returns number

### Protected set_phase

- set_phase(value: string): string

- - Defined in lib/starling/events/Touch.d.ts:90

  #### Parameters

  - ##### value: string

  #### Returns string

### Protected set_pressure

- set_pressure(value: number): number

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

  #### Parameters

  - ##### value: number

  #### Returns number

### Protected set_tapCount

- set_tapCount(value: number): number

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

  #### Parameters

  - ##### value: number

  #### Returns number

### Protected set_target

- set_target(value: DisplayObject): DisplayObject

- - Defined in lib/starling/events/Touch.d.ts:95

  #### Parameters

  - ##### value: DisplayObject

  #### Returns DisplayObject

### Protected set_timestamp

- set_timestamp(value: number): number

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

  #### Parameters

  - ##### value: number

  #### Returns number

### Protected set_width

- set_width(value: number): number

- - Defined in lib/starling/events/Touch.d.ts:112

  #### Parameters

  - ##### value: number

  #### Returns number

### toString

- toString(): string

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

  Returns a description of the object.

  #### Returns string

Generated using TypeDoc