Cocos Creator API

1.0.0

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

ActionManager

Module: cc

cc.ActionManager is a class that can manage actions.
Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface, which uses this class's singleton object. But there are some cases where you might need to use this class.
Examples:

  • When you want to run an action where the target is different from a CCNode.
  • When you want to pause / resume the actions

examples:

----
var mng = new cc.ActionManager();

Methods

addAction
(
  • action
  • target
  • paused
)

If the target is already present, then the action will be added to the existing target. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target. When the target is paused, the queued actions won't be 'ticked'.

name type description
action Action
target Node
paused Boolean

removeAllActions ( )

Removes all actions from all the targets.

removeAllActionsFromTarget
(
  • target
  • forceDelete
)

All the actions that belongs to the target will be removed.

name type description
target object
forceDelete boolean

removeAction
(
  • action
)

name type description
action Action

removeActionByTag
(
  • tag
  • target
)

name type description
tag Number
target object

getActionByTag
(
  • tag
  • target
)
Action | Null

name type description
tag Number
target object

returns:

type: Action | Null

return the Action with the given tag on success

numberOfRunningActionsInTarget
(
  • target
)
Number

Composable actions are counted as 1 action.
Example:

  • If you are running 1 Sequence of 7 actions, it will return 1.
  • If you are running 7 Sequences of 2 actions, it will return 7.
name type description
target object

returns:

type: Number

pauseTarget
(
  • target
)

name type description
target object

resumeTarget
(
  • target
)

name type description
target object

pauseAllRunningActions ( ) Array

Pauses all running actions, returning a list of targets whose actions were paused.

returns:

type: Array

a list of targets whose actions were paused.

resumeTargets
(
  • targetsToResume
)

Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call)

name type description
targetsToResume Array

pauseTargets
(
  • targetsToPause
)

Pause a set of targets

name type description
targetsToPause Array

purgeSharedManager ( )

because it uses this, so it can not be static

update
(
  • dt
)

name type description
dt Number

delta time in seconds

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