ActionManager
Class
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();
Index
Methods
addAction
If the target is already present, then the action will be added to the existing target.removeAllActions
Removes all actions from all the targets.removeAllActionsFromTarget
Removes all actions from a certain target.removeAction
Removes an action given an action reference.removeActionByTag
Removes an action given its tag and the target.removeAllActionsByTag
Removes all actions given the tag and the target.getActionByTag
Gets an action given its tag an a target.getNumberOfRunningActionsInTarget
Returns the numbers of actions that are running in a certain target.pauseTarget
Pauses the target: all running actions and newly added actions will be paused.resumeTarget
Resumes the target.pauseAllRunningActions
Pauses all running actions, returning a list of targets whose actions were paused.resumeTargets
Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).pauseTargets
Pause a set of targets.purgeSharedManager
purges the shared action manager.update
The ActionManager update。
Details
Methods
addAction
Adds an action with a target.
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'.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:105 |
Parameters
removeAllActions
Removes all actions from all the targets.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:144 |
removeAllActionsFromTarget
Removes all actions from a certain target.
All the actions that belongs to the target will be removed.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:159 |
Parameters
removeAction
Removes an action given an action reference.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:180 |
Parameters
action
Action
removeActionByTag
Removes an action given its tag and the target.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:240 |
Parameters
removeAllActionsByTag
Removes all actions given the tag and the target.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:266 |
Parameters
getActionByTag
Gets an action given its tag an a target.
meta | description |
---|---|
Returns | Action | Null |
Defined in | cocos2d/actions/CCActionManager.js:292 |
Parameters
getNumberOfRunningActionsInTarget
Returns the numbers of actions that are running in a certain target.
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.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/actions/CCActionManager.js:319 |
Parameters
target
Node
pauseTarget
Pauses the target: all running actions and newly added actions will be paused.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:344 |
Parameters
target
Node
resumeTarget
Resumes the target. All queued actions will be resumed.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:355 |
Parameters
target
Node
pauseAllRunningActions
Pauses all running actions, returning a list of targets whose actions were paused.
meta | description |
---|---|
Returns | Array |
Defined in | cocos2d/actions/CCActionManager.js:367 |
resumeTargets
Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:386 |
Parameters
targetsToResume
Array
pauseTargets
Pause a set of targets.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:402 |
Parameters
targetsToPause
Array
purgeSharedManager
purges the shared action manager. It releases the retained instance.
because it uses this, so it can not be static.
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:418 |
update
The ActionManager update。
meta | description |
---|---|
Defined in | cocos2d/actions/CCActionManager.js:465 |
Parameters
dt
Number delta time in seconds