pixiflash.MovieClip Class
The class to emulate createjs.MovieClip, requires TweenJS
Item Index
Methods
- _addManagedChild
- _goto
- _reset
- _setState
- _tick
- _updateTimeline
- advance
- getCurrentLabel deprecated
- getLabels deprecated
- gotoAndPlay
- gotoAndStop
- play
- stop
Properties
Methods
_addManagedChild
-
child
-
offset
Adds a child to the timeline, and sets it up as a managed child.
Parameters:
-
child
MovieClipThe child MovieClip to manage
-
offset
Number
_goto
-
positionOrLabel
_reset
()
private
_tick
-
delta
Parameters:
-
delta
NumberTime elapsed since the previous tick, in milliseconds. function.
_updateTimeline
()
protected
advance
-
[time]
Advances the playhead. This occurs automatically each tick by default.
Parameters:
-
[time]
Number optionalThe amount of time in ms to advance by. Only applicable if framerate is set.
getCurrentLabel
()
String
deprecated
Use the MovieClip/currentLabel:property property instead.
Returns:
gotoAndPlay
-
positionOrLabel
Advances this movie clip to the specified position or label and sets paused to false.
gotoAndStop
-
positionOrLabel
Advances this movie clip to the specified position or label and sets paused to true.
play
()
Sets paused to false.
stop
()
Sets paused to true.
Properties
_duration
Number
private
When the MovieClip is framerate independent, this is the total time in seconds for the animation.
Default: 0
_framerate
Number
By default MovieClip instances advance one frame per tick. Specifying a framerate for the MovieClip will cause it to advance based on elapsed time between ticks as appropriate to maintain the target framerate.
Default: 0
_t
Number
private
Note - changed from default: When the MovieClip is framerate independent, this is the time elapsed from frame 0 in seconds.
Default: 0
actionsEnabled
Boolean
If true, actions in this MovieClip's tweens will be run when the playhead advances.
Default: true
autoReset
Boolean
If true, the MovieClip will automatically be reset to its first frame whenever the timeline adds
it back onto the display list. This only applies to MovieClip instances with mode=INDEPENDENT.
For example, if you had a character animation with a "body" child MovieClip instance
with different costumes on each frame, you could set body.autoReset = false, so that
you can manually change the frame it is on, without worrying that it will be reset
automatically.
Default: true
currentLabel
String
Returns the name of the label on or immediately before the current frame. See TweenJS: Timeline.getCurrentLabel() for more information.
elapsedTime
Number
public
When the MovieClip is framerate independent, this is the time elapsed from frame 0 in seconds.
Default: 0
framerate
Number
By default MovieClip instances advance one frame per tick. Specifying a framerate for the MovieClip will cause it to advance based on elapsed time between ticks as appropriate to maintain the target framerate.
For example, if a MovieClip with a framerate of 10 is placed on a Stage being updated at 40fps, then the MovieClip will advance roughly one frame every 4 ticks. This will not be exact, because the time between each tick will vary slightly between frames.
This feature is dependent on the tick event object (or an object with an appropriate "delta" property) being passed into Stage/update.
Default: 0
INDEPENDENT
String
static
The MovieClip will advance independently of its parent, even if its parent is paused. This is the default mode.
Default: "independent"
labels
Array
Returns an array of objects with label and position (aka frame) properties, sorted by position. Shortcut to TweenJS: Timeline.getLabels();
loop
Boolean
Indicates whether this MovieClip should loop when it reaches the end of its timeline.
Default: true
mode
String
Controls how this MovieClip advances its time. Must be one of 0 (INDEPENDENT), 1 (SINGLE_FRAME), or 2 (SYNCHED). See each constant for a description of the behaviour.
Default: null
SINGLE_FRAME
String
static
The MovieClip will only display a single frame (as determined by the startPosition property).
Default: "single"
startPosition
Number
Specifies what the first frame to play in this movieclip, or the only frame to display if mode is SINGLE_FRAME.
Default: 0
SYNCHED
String
static
The MovieClip will be advanced only when its parent advances and will be synched to the position of the parent MovieClip.
Default: "synched"
timeline
Timeline
The TweenJS Timeline that is associated with this MovieClip. This is created automatically when the MovieClip instance is initialized. Animations are created by adding TweenJS Tween instances to the timeline.
Example
var tween = createjs.Tween.get(target).to({x:0}).to({x:100}, 30);
var mc = new createjs.MovieClip();
mc.timeline.addTween(tween);
Elements can be added and removed from the timeline by toggling an "_off" property
using the tweenInstance.to()
method. Note that using Tween.set
is not recommended to
create MovieClip animations. The following example will toggle the target off on frame 0, and then back on for
frame 1. You can use the "visible" property to achieve the same effect.
var tween = createjs.Tween.get(target).to({_off:false})
.wait(1).to({_off:true})
.wait(1).to({_off:false});
Default: null