Class BitmapSequence
Extends
DisplayObject.
Displays frames or sequences of frames from a sprite sheet image. A sprite sheet is a series of images (usually animation frames) combined into a single image on a regular grid. For example, an animation consisting of 8 100x100 images could be combined into a 400x200 sprite sheet (4 frames across by 2 high). You can display individual frames, play sequential frames as an animation, and even sequence animations together.
The simplest way to use BitmapSequence is to specify the image, frameWidth, frameHeight. It will then play all of the frames in the animation and loop if the loop property is true. In this simple mode, you can also use the currentFrame property to move between frames manually, and you can set the totalFrames property if you have extraneous frames in your sprite sheet (for example, a 2x4 frame sprite sheet, with only 7 frames used).
A more advanced usage of BitmapSequence is to set a frameData property, which provides named sequences and frames which can be played and sequenced together. See frameData for more information.
Defined in: BitmapSequence.js.
Constructor Attributes | Constructor Name and Description |
---|---|
BitmapSequence(image, frameWidth, frameHeight)
Constructs a BitmapSequence object with the specified source image.
|
Field Attributes | Field Name and Description |
---|---|
<private> | |
<private> | |
Specifies a funciton to call whenever any sequence reaches its end.
|
|
Returns the last frame of the currently playing sequence when using frameData.
|
|
The frame that will be drawn on the next tick.
|
|
Returns the currently playing sequence when using frameData.
|
|
Returns the first frame of the currently playing sequence when using frameData.
|
|
Defines named frames and frame sequences.
|
|
The loop property is only used if no frameData is specified, and indicates whether all frames (as specified with totalFrames) should loop.
|
|
Returns the name of the next sequence that will be played, or null if it will stop playing after the current sequence.
|
|
Prevents the animation from advancing each tick automatically.
|
|
Specifies the total number of frames in the sprite sheet if no frameData is specified.
|
- Fields borrowed from class DisplayObject:
- _activeContext, _cacheDraw, _cacheOffsetX, _cacheOffsetY, _restoreContext, _revertShadow, _revertX, _revertY, alpha, cacheCanvas, id, mouseEnabled, name, parent, regX, regY, rotation, scaleX, scaleY, shadow, visible, x, y
Method Attributes | Method Name and Description |
---|---|
cache()
Because the content of a Bitmap is already in a simple format, cache is unnecessary for BitmapSequence instances.
|
|
<private> |
cloneProps(o)
|
goto(frameOrSequence)
Seeks to the specified sequence name, named frame, or frame number without modifying the paused property.
|
|
gotoAndPlay(frameOrSequence)
Sets paused to false and plays the specified sequence name, named frame, or frame number.
|
|
gotoAndStop(frameOrSequence)
Sets paused to true and seeks to the specified sequence name, named frame, or frame number.
|
|
<private> |
init(image, frameWidth, frameHeight)
|
tick()
Advances the currentFrame if paused is not true.
|
|
uncache()
Because the content of a Bitmap is already in a simple format, cache is unnecessary for BitmapSequence instances.
|
- Methods borrowed from class DisplayObject:
- applyShadow, clone, draw, getStage, revertContext, toString, updateContext
- Parameters:
- image
- The Image, Canvas, or Video to use as a sprite sheet.
- frameWidth
- The width in pixels of each frame on the sprite sheet.
- frameHeight
- The height in pixels of each frame on the sprite sheet.
{walk:[0,20], shoot:[21,25,"walk"], crouch:[26,30,false], stand:31}
This will create 3 sequences and a named frame. The first sequence will be named "walk", and will loop frames 0 to 20 inclusive. The second sequence will be named "shoot", and will play frames 21 to 25 then play the walk sequence. The third sequence "crouch" will play frames 26 to 30 then pause on frame 30, due to false being passed as the next sequence. The named frame "stand" will display frame 31. *
- Parameters:
- o
- Parameters:
- frameOrSequence
- Parameters:
- frameOrSequence
- Parameters:
- frameOrSequence
- Parameters:
- image
- frameWidth
- frameHeight