Class cc.Action
- Defined in: CCAction.js
- Extends cc.Class
Constructor Attributes | Constructor Name and Description |
---|---|
Base class for cc.Action objects.
|
Method Summary
Class Detail
cc.Action()
Base class for cc.Action objects.
Method Detail
-
{cc.Action} clone()returns a clone of action
- Returns:
- {cc.Action}
-
{object} copy()to copy object with deep copy.
- Returns:
- {object}
-
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