Class Index | File Index

Classes


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.

Class Summary
Constructor Attributes Constructor Name and Description
 
BitmapSequence(image, frameWidth, frameHeight)
Constructs a BitmapSequence object with the specified source image.
Field Summary
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 Summary
Method Attributes Method Name and Description
 
Because the content of a Bitmap is already in a simple format, cache is unnecessary for BitmapSequence instances.
<private>  
 
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.
 
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
Class Detail
BitmapSequence(image, frameWidth, frameHeight)
Constructs a BitmapSequence object with the specified source image.
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.
Field Detail
<private> _cloneProps

<private> _init

callback
Specifies a funciton to call whenever any sequence reaches its end. *

currentEndFrame
Returns the last frame of the currently playing sequence when using frameData. READ-ONLY. *

currentFrame
The frame that will be drawn on the next tick. This can also be set, but it will not update the current sequence, so it may result in unexpected behaviour if you are using frameData. *

currentSequence
Returns the currently playing sequence when using frameData. READ-ONLY. *

currentStartFrame
Returns the first frame of the currently playing sequence when using frameData. READ-ONLY. *

frameData
Defines named frames and frame sequences. Frame data is specified as a generic object, where each property name will be used to define a new named frame or sequence. Named frames specify a frame number. Sequences are defined using an array of 2 or 3 values: the start frame, the end frame, and optionally the name of the next sequence to play. For example, examine the following frame data:
{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. *

loop
The loop property is only used if no frameData is specified, and indicates whether all frames (as specified with totalFrames) should loop. If false, the animation will play to totalFrames, then pause. *

nextSequence
Returns the name of the next sequence that will be played, or null if it will stop playing after the current sequence. READ-ONLY. *

paused
Prevents the animation from advancing each tick automatically. For example, you could create a sprite sheet of icons, set paused to true, and display the appropriate icon by setting currentFrame. *

totalFrames
Specifies the total number of frames in the sprite sheet if no frameData is specified. This is useful for excluding extraneous frames (for example, if you have 7 frames in a 2x4 sprite sheet). The total frames will be calculated based on frame and image dimensions if totalFrames is 0. *
Method Detail
cache()
Because the content of a Bitmap is already in a simple format, cache is unnecessary for BitmapSequence instances.

<private> cloneProps(o)
Parameters:
o

goto(frameOrSequence)
Seeks to the specified sequence name, named frame, or frame number without modifying the paused property.
Parameters:
frameOrSequence

gotoAndPlay(frameOrSequence)
Sets paused to false and plays the specified sequence name, named frame, or frame number.
Parameters:
frameOrSequence

gotoAndStop(frameOrSequence)
Sets paused to true and seeks to the specified sequence name, named frame, or frame number.
Parameters:
frameOrSequence

<private> init(image, frameWidth, frameHeight)
Parameters:
image
frameWidth
frameHeight

tick()
Advances the currentFrame if paused is not true. This is called automatically when the Stage ticks.

uncache()
Because the content of a Bitmap is already in a simple format, cache is unnecessary for BitmapSequence instances.

Documentation generated by JsDoc Toolkit 2.3.2 on Tue Dec 07 2010 15:40:00 GMT-0700 (MST)