| Package | com.pblabs.rendering2D.spritesheet |
| Class | public class SpriteSheetComponent |
| Inheritance | SpriteSheetComponent SpriteContainerComponent EntityComponent Object |
Functionality exists to allow several directions to be specified per frame. This enables you to, for instance, visually rotate a sprite without rotating the actual object it belongs to.
Because we may group them in different ways, we distinguish between "raw frames" and a "frame" which might be made up of multiple directions.
On the subject of sprite sheet order: the divider may alter this, but in general, frames are numbered left to right, top to bottom. If you have a 4 direction sprite sheet, then 0,1,2,3 will be frame 1, 4,5,6,7 will be 2, and so on.
Be aware that Flash implements an upper limit on image size - going over 2048 pixels in any dimension will lead to problems.
| Property | Defined By | ||
|---|---|---|---|
![]() | center : Point
Specifies an offset so the sprite is centered correctly. | SpriteContainerComponent | |
![]() | centered : Boolean [read-only]
Indicates that the spriteSheet has a centered alignment. | SpriteContainerComponent | |
![]() | degreesPerDirection : Number [read-only]
The number of degrees separating each direction. | SpriteContainerComponent | |
![]() | directionsPerFrame : Number = 1
The number of directions per frame. | SpriteContainerComponent | |
| divider : ISpriteSheetDivider
The divider to use to chop up the sprite sheet into frames. | SpriteSheetComponent | ||
| failed : Boolean [read-only]
Indicates if the ImageResource has failed loading
| SpriteSheetComponent | ||
![]() | frameCount : int
The number of frames the sprite container has. | SpriteContainerComponent | |
| image : ImageResource
The image resource to use for this sprite sheet. | SpriteSheetComponent | ||
| imageData : BitmapData [read-only]
The bitmap data of the loaded image. | SpriteSheetComponent | ||
| imageFilename : String
The filename of the image to use for this sprite sheet. | SpriteSheetComponent | ||
| isLoaded : Boolean [override] [read-only]
True if the image data associated with this sprite sheet has been loaded. | SpriteSheetComponent | ||
![]() | isRegistered : Boolean [read-only]
Whether or not the component is currently registered with an entity. | EntityComponent | |
| loaded : Boolean [read-only]
Indicates if the ImageResource has been loaded
| SpriteSheetComponent | ||
| loading : Boolean [read-only]
Indicates if the ImageResource loading is in progress
| SpriteSheetComponent | ||
![]() | modifiers : Array
Array with BitmapData modifiers that will be pre-rendered
| SpriteContainerComponent | |
![]() | name : String [read-only]
The name given to the component when it is added to an entity. | EntityComponent | |
![]() | owner : IEntity
A reference to the entity that this component currently belongs to. | EntityComponent | |
![]() | rawFrameCount : int [read-only]
The total number of frames the sprite container has. | SpriteContainerComponent | |
| Method | Defined By | ||
|---|---|---|---|
![]() | getFrame(index:int, direction:Number = 0.0):BitmapData
Gets the bitmap data for a frame at the specified index. | SpriteContainerComponent | |
initializeFromBitmapDataArray(bitmaps:Array):void
From an array of BitmapDatas, initialize the sprite sheet, ignoring
divider + filename. | SpriteSheetComponent | ||
![]() |
Registers the component with an entity. | EntityComponent | |
![]() | reset():void
This is called by an entity on all of its components any time a component
is added or removed. | EntityComponent | |
![]() | unregister():void
Unregisters the component from an entity. | EntityComponent | |
| Method | Defined By | ||
|---|---|---|---|
![]() | buildFrames():void | SpriteContainerComponent | |
![]() | deleteFrames():void
Deletes the frames so this class can be re-used with a new set of frames. | SpriteContainerComponent | |
![]() | getRawFrame(index:int):BitmapData
Gets the frame at the specified index. | SpriteContainerComponent | |
getSourceFrames():Array [override] | SpriteSheetComponent | ||
onAdd():void [override] | SpriteSheetComponent | ||
onImageFailed(resource:ImageResource):void | SpriteSheetComponent | ||
onImageLoaded(resource:ImageResource):void | SpriteSheetComponent | ||
onRemove():void [override] | SpriteSheetComponent | ||
![]() | onReset():void
This is called anytime a component is added or removed from the owner entity. | EntityComponent | |
| divider | property |
divider:ISpriteSheetDividerThe divider to use to chop up the sprite sheet into frames. If the divider isn't set, the image will be treated as one whole frame.
public function get divider():ISpriteSheetDivider public function set divider(value:ISpriteSheetDivider):void| failed | property |
failed:Boolean [read-only] Indicates if the ImageResource has failed loading
public function get failed():Boolean| image | property |
image:ImageResourceThe image resource to use for this sprite sheet.
public function get image():ImageResource public function set image(value:ImageResource):void| imageData | property |
imageData:BitmapData [read-only] The bitmap data of the loaded image.
public function get imageData():BitmapData| imageFilename | property |
imageFilename:StringThe filename of the image to use for this sprite sheet.
public function get imageFilename():String public function set imageFilename(value:String):void| isLoaded | property |
isLoaded:Boolean [read-only] [override] True if the image data associated with this sprite sheet has been loaded.
public function get isLoaded():Boolean| loaded | property |
loaded:Boolean [read-only] Indicates if the ImageResource has been loaded
public function get loaded():Boolean| loading | property |
loading:Boolean [read-only] Indicates if the ImageResource loading is in progress
public function get loading():Boolean| getSourceFrames | () | method |
override protected function getSourceFrames():ArrayReturnsArray |
| initializeFromBitmapDataArray | () | method |
public function initializeFromBitmapDataArray(bitmaps:Array):voidFrom an array of BitmapDatas, initialize the sprite sheet, ignoring divider + filename.
Parameters
bitmaps:Array |
| onAdd | () | method |
override protected function onAdd():void| onImageFailed | () | method |
| onImageLoaded | () | method |
| onRemove | () | method |
override protected function onRemove():void