Event.EventTouch Class

Extends Event

Module: cc

The touch event

Index

Properties
  • touch Touch The current touch object
  • type String The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  • bubbles Boolean Indicate whether the event bubbles up through the tree or not.
  • target Object A reference to the target to which the event was originally dispatched.
  • currentTarget Object A reference to the currently registered target for the event.
  • eventPhase Number Indicates which phase of the event flow is currently being evaluated. Returns an integer value represented by 4 constants:
    • Event.NONE = 0
    • Event.CAPTURING_PHASE = 1
    • Event.AT_TARGET = 2
    • Event.BUBBLING_PHASE = 3 The phases are explained in the [section 3.1, Event dispatch and DOM event flow] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
Methods
  • constructor
  • getEventCode Returns event code.
  • getTouches Returns touches of event.
  • setLocation Sets touch location.
  • getLocation Returns touch location.
  • getLocationInView Returns the current touch location in screen coordinates.
  • getPreviousLocation Returns the previous touch location.
  • getStartLocation Returns the start touch location.
  • getID Returns the id of cc.Touch.
  • getDelta Returns the delta distance from the previous location to current location.
  • getDeltaX Returns the X axis delta distance from the previous location to current location.
  • getDeltaY Returns the Y axis delta distance from the previous location to current location.
  • getLocationX Returns location X axis data.
  • getLocationY Returns location Y axis data.
  • unuse Reset the event for being stored in the object pool.
  • reuse Reuse the event for being used again by the object pool.
  • stopPropagation Stops propagation for current event.
  • stopPropagationImmediate Stops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.
  • isStopped Checks whether the event has been stopped.
  • getCurrentTarget

    Gets current target of the event
    note: It only be available when the event listener is associated with node.

     It returns 0 when the listener is associated with fixed priority.
    
    </p>

  • getType Gets the event type.

Details

Properties

touch

The current touch object

meta description
Type Touch
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:336
type

The name of the event (case-sensitive), e.g. "click", "fire", or "submit".

meta description
Type String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:43
bubbles

Indicate whether the event bubbles up through the tree or not.

meta description
Type Boolean
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:51
target

A reference to the target to which the event was originally dispatched.

meta description
Type Object
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:59
currentTarget

A reference to the currently registered target for the event.

meta description
Type Object
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:67
eventPhase

Indicates which phase of the event flow is currently being evaluated. Returns an integer value represented by 4 constants:

  • Event.NONE = 0
  • Event.CAPTURING_PHASE = 1
  • Event.AT_TARGET = 2
  • Event.BUBBLING_PHASE = 3 The phases are explained in the [section 3.1, Event dispatch and DOM event flow] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:75

Methods

constructor
meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:327
Parameters
  • touchArr Array The array of the touches
  • bubbles Boolean A boolean indicating whether the event bubbles up through the tree or not
getEventCode

Returns event code.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:351
getTouches

Returns touches of event.

meta description
Returns Array
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:361
setLocation

Sets touch location.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:379
Parameters
getLocation

Returns touch location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:390
getLocationInView

Returns the current touch location in screen coordinates.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:400
getPreviousLocation

Returns the previous touch location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:410
getStartLocation

Returns the start touch location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:420
getID

Returns the id of cc.Touch.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:430
getDelta

Returns the delta distance from the previous location to current location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:440
getDeltaX

Returns the X axis delta distance from the previous location to current location.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:450
getDeltaY

Returns the Y axis delta distance from the previous location to current location.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:460
getLocationX

Returns location X axis data.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:470
getLocationY

Returns location Y axis data.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:480
unuse

Reset the event for being stored in the object pool.

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:110
reuse

Reuse the event for being used again by the object pool.

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:125
stopPropagation

Stops propagation for current event.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:136
stopPropagationImmediate

Stops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:145
isStopped

Checks whether the event has been stopped.

meta description
Returns Boolean
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:155
getCurrentTarget

Gets current target of the event
note: It only be available when the event listener is associated with node.
It returns 0 when the listener is associated with fixed priority.

meta description
Returns Node
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:165
getType

Gets the event type.

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:180

results matching ""

    No results matching ""