Cocos Creator API

1.3.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Event.EventMouse

: cc

The mouse event

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.

NO_TYPE String readOnly

Code for event without type.

NONE Number readOnly

Events not currently dispatched are in this phase

CAPTURING_PHASE Number readOnly

The capturing phase comprises the journey from the root to the last node before the event target's node see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow

AT_TARGET Number readOnly

The target phase comprises only the event target node see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow

BUBBLING_PHASE Number readOnly

The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

setScrollData
(
  • scrollX
  • scrollY
)

Sets scroll data.

scrollX Number
scrollY Number

getScrollX ( ) Number

Returns the x axis scroll value.

:

: Number

getScrollY ( ) Number

Returns the y axis scroll value.

:

: Number

setLocation
(
  • x
  • y
)

Sets cursor location.

getLocation ( ) Vec2

Returns cursor location.

:

: Vec2

location

getLocationInView ( ) Vec2

Returns the current cursor location in screen coordinates.

:

: Vec2

getPreviousLocation ( ) Vec2

Returns the previous touch location.

:

: Vec2

getDelta ( ) Vec2

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

:

: Vec2

getDeltaX ( ) Number

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

:

: Number

getDeltaY ( ) Number

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

:

: Number

setButton
(
  • button
)

Sets mouse button.

button Number

getButton ( ) Number

Returns mouse button.

:

: Number

getLocationX ( ) Number

Returns location X axis data.

:

: Number

getLocationY ( ) Number

Returns location Y axis data.

:

: Number

Event
(
  • type
  • bubbles
)
Event

type String

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

bubbles Boolean

A boolean indicating whether the event bubbles up through the tree or not

:

: Event

unuse ( ) String

Reset the event for being stored in the object pool.

:

: String

reuse ( ) String

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

:

: String

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 ( ) Boolean

Checks whether the event has been stopped.

:

getCurrentTarget ( ) Node

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.

:

: Node

The target with which the event associates.

getType ( ) String

Gets the event type.

:

: String

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index