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. See the SpriteSheet class for more information on setting up frames and animation.
Constructor
BitmapSequence
(
spriteSheet
)
- Parameters:
-
spriteSheet
<SpriteSheet>
The SpriteSheet instance to play back. This includes the source image, frame
dimensions, and frame data. See SpriteSheet for more information.
Properties
Specifies a function to call whenever any sequence reaches its end.
Returns the last frame of the currently playing sequence when using frameData. READ-ONLY.
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 behavior if you are using frameData.
Default Value: -1
Returns the currently playing sequence when using frameData. READ-ONLY.
Returns the first frame of the currently playing sequence when using frameData. READ-ONLY.
Returns the name of the next sequence that will be played, or null if it will stop playing after the
current sequence. READ-ONLY.
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.
Default Value: false
Whether or not the Bitmap should be draw to the canvas at whole pixel coordinates.
Default Value: true
The SpriteSheet instance to play back. This includes the source image, frame dimensions, and frame
data. See SpriteSheet for more information.
Properties inherited from DisplayObject:
_activeContext,
_cacheDraw,
_cacheOffsetX,
_cacheOffsetY,
_restoreContext,
_revertAlpha,
_revertShadow,
_revertX,
_revertY,
alpha,
cacheCanvas,
compositeOperation,
id,
mouseEnabled,
name,
parent,
regX,
regY,
rotation,
scaleX,
scaleY,
shadow,
skewX,
skewY,
snapToPixel,
visible,
x,
y
Methods
protected
void
_goto
(
frameOrSequence
)
Moves the playhead to the specified frame number of sequence.
- Parameters:
-
frameOrSequence
<String|Number>
The frame number of sequence that the playhead should move to.
- Returns:
void
void
cache
(
)
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances.
You should not cache Bitmap instances as it can degrade performance.
Point
clone
(
)
Returns a clone of the Point instance.
- Returns:
Point
- a clone of the Point instance.
protected
void
cloneProps
(
o
)
- Parameters:
-
o
<Text>
- Returns:
void
void
draw
(
ctx
,
ignoreCache
)
Draws the display object into the specified context ignoring it's visible, alpha, shadow, and transform.
Returns true if the draw was handled (useful for overriding functionality).
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
- Parameters:
-
ctx
<CanvasRenderingContext2D>
The canvas 2D context object to draw into.
-
ignoreCache
<Boolean>
Indicates whether the draw operation should ignore any current cache.
For example, used for drawing the cache (to prevent it from simply drawing an existing cache back
into itself).
- Returns:
void
void
gotoAndPlay
(
frameOrSequence
)
Sets paused to false and plays the specified sequence name, named frame, or frame number.
- Parameters:
-
frameOrSequence
<String|Number>
The frame number or sequence that the playhead should move to
and begin playing.
- Returns:
void
void
gotoAndStop
(
frameOrSequence
)
Sets paused to true and seeks to the specified sequence name, named frame, or frame number.
- Parameters:
-
frameOrSequence
<String|Number>
The frame number or sequence that the playhead should move to
and stop.
- Returns:
void
protected
void
initialize
(
)
Initialization method.
Boolean
isVisible
(
)
Returns true or false indicating whether the display object would be visible if drawn to a canvas.
This does not account for whether it would be visible within the boundaries of the stage.
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
- Returns:
Boolean
- Boolean indicating whether the display object would be visible if drawn to a canvas
void
tick
(
)
Advances the currentFrame if paused is not true. This is called automatically when the Stage ticks.
String
toString
(
)
Returns a string representation of this object.
- Returns:
String
- a string representation of the instance.
void
uncache
(
)
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances.
You should not cache Bitmap instances as it can degrade performance.
void
updateCache
(
)
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances.
You should not cache Bitmap instances as it can degrade performance.
_testHit,
applyShadow,
cache,
clone,
cloneProps,
draw,
getConcatenatedMatrix,
getStage,
globalToLocal,
hitTest,
initialize,
isVisible,
localToGlobal,
localToLocal,
toString,
uncache,
updateCache