Class cc.Action

Class Summary
Constructor Attributes Constructor Name and Description
 
Base class for cc.Action objects.

Method Summary

Class Detail

cc.Action()
Base class for cc.Action objects.

Field Detail

{cc.Node} originalTarget
- The original target of the action.
{Number} tag
- The tag of the action, can be used to find the action.
{cc.Node} target
- The target will be set with the 'startWithTarget' method. When the 'stop' method is called, target will be set to nil.

Method Detail

  • {cc.Action} clone()
    returns a clone of action
    Returns:
    {cc.Action}
  • {object} copy()
    to copy object with deep copy.
    Returns:
    {object}
  • <static> {cc.Action} cc.Action.create()
    Allocates and initializes the action
    // example
    var action = cc.Action.create();
    Returns:
    {cc.Action}
  • {cc.Node} getOriginalTarget()
    Returns:
    {cc.Node}
  • {Number} getTag()
    Returns:
    {Number}
  • {cc.Node} getTarget()
    Returns:
    {cc.Node}
  • {Boolean} isDone()
    return true if the action has finished
    Returns:
    {Boolean}
  • retain()
    Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB, and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB. This is a hack, and should be removed once JSB fixes the retain/release bug
  • setOriginalTarget(originalTarget)
    Set the original target, since target can be nil.
    Is the target that were used to run the action.
    Unless you are doing something complex, like cc.ActionManager, you should NOT call this method.
    The target is 'assigned', it is not 'retained'.
    Parameters:
    {cc.Node} originalTarget
  • setTag(tag)
    Parameters:
    {Number} tag
  • setTarget(target)
    The action will modify the target properties.
    Parameters:
    {cc.Node} target
  • startWithTarget(target)
    called before the action start. It will also set the target.
    Parameters:
    {cc.Node} target
  • step(dt)
    called every frame with it's delta time. DON'T override unless you know what you are doing.
    Parameters:
    {Number} dt
  • stop()
    called after the action has finished. It will set the 'target' to nil. IMPORTANT: You should never call "action stop" manually. Instead, use: "target.stopAction(action);"
  • update(time)

    called once per frame. time a value between 0 and 1

    For example:
    - 0 means that the action just started
    - 0.5 means that the action is in the middle
    - 1 means that the action is over

    Parameters:
    {Number} time