Class cc.ActionManager

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.ActionManager is a class that can manage actions.

Method Summary

Class Detail

cc.ActionManager()
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
var mng = new cc.ActionManager();

Method Detail

  • addAction(action, target, paused)
    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'.
    Parameters:
    {cc.Action} action
    {cc.Node} target
    {Boolean} paused
  • {cc.Action|Null} getActionByTag(tag, target)
    Gets an action given its tag an a target
    Parameters:
    {Number} tag
    {object} target
    Returns:
    {cc.Action|Null} return the Action with the given tag on success
  • {Number} numberOfRunningActionsInTarget(target)
    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.
    Parameters:
    {object} target
    Returns:
    {Number}
  • {Array} pauseAllRunningActions()
    Pauses all running actions, returning a list of targets whose actions were paused.
    Returns:
    {Array} a list of targets whose actions were paused.
  • pauseTarget(target)
    Pauses the target: all running actions and newly added actions will be paused.
    Parameters:
    {object} target
  • purgeSharedManager()
    purges the shared action manager. It releases the retained instance.
    because it uses this, so it can not be static
  • removeAction(action)
    Removes an action given an action reference.
    Parameters:
    {cc.Action} action
  • removeActionByTag(tag, target)
    Removes an action given its tag and the target
    Parameters:
    {Number} tag
    {object} target
  • removeAllActions()
    Removes all actions from all the targets.
  • removeAllActionsFromTarget(target, forceDelete)
    Removes all actions from a certain target.
    All the actions that belongs to the target will be removed.
    Parameters:
    {object} target
    {boolean} forceDelete
  • resumeTarget(target)
    Resumes the target. All queued actions will be resumed.
    Parameters:
    {object} target
  • resumeTargets(targetsToResume)
    Resume a set of targets (convenience function to reverse a pauseAllRunningActions call)
    Parameters:
    {Array} targetsToResume
  • update(dt)
    Parameters:
    {Number} dt
    delta time in seconds