Packagecom.pblabs.rendering2D.spritesheet
Classpublic class SpriteContainerComponent
InheritanceSpriteContainerComponent Inheritance EntityComponent Inheritance Object
Subclasses SpriteSheetComponent, SWFSpriteSheetComponent

An abstract class to allow access to a set of sprites. This needs to be inherited to be of any use.

See also

SpriteSheetComponent
SWFSpriteSheetComponent


Public Properties
 PropertyDefined 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
  frameCount : int
The number of frames the sprite container has.
SpriteContainerComponent
  isLoaded : Boolean
[read-only] True if the frames associated with this sprite container have been loaded.
SpriteContainerComponent
 InheritedisRegistered : Boolean
[read-only] Whether or not the component is currently registered with an entity.
EntityComponent
  modifiers : Array
Array with BitmapData modifiers that will be pre-rendered
SpriteContainerComponent
 Inheritedname : String
[read-only] The name given to the component when it is added to an entity.
EntityComponent
 Inheritedowner : 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
Protected Properties
 PropertyDefined By
  frames : Array = null
SpriteContainerComponent
Public Methods
 MethodDefined By
  
getFrame(index:int, direction:Number = 0.0):BitmapData
Gets the bitmap data for a frame at the specified index.
SpriteContainerComponent
 Inherited
register(owner:IEntity, name:String):void
Registers the component with an entity.
EntityComponent
 Inherited
reset():void
This is called by an entity on all of its components any time a component is added or removed.
EntityComponent
 Inherited
unregister():void
Unregisters the component from an entity.
EntityComponent
Protected Methods
 MethodDefined By
  
SpriteContainerComponent
  
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
  
Subclasses must override this method and return an array of BitmapData objects.
SpriteContainerComponent
 Inherited
onAdd():void
This is called when the component is added to an entity.
EntityComponent
 Inherited
onRemove():void
This is called when the component is removed from an entity.
EntityComponent
 Inherited
onReset():void
This is called anytime a component is added or removed from the owner entity.
EntityComponent
Property Detail
centerproperty
center:Point

Specifies an offset so the sprite is centered correctly. If it is not set, the sprite is centered.


Implementation
    public function get center():Point
    public function set center(value:Point):void
centeredproperty 
centered:Boolean  [read-only]

Indicates that the spriteSheet has a centered alignment.


Implementation
    public function get centered():Boolean
degreesPerDirectionproperty 
degreesPerDirection:Number  [read-only]

The number of degrees separating each direction.


Implementation
    public function get degreesPerDirection():Number
directionsPerFrameproperty 
public var directionsPerFrame:Number = 1

The number of directions per frame.

frameCountproperty 
frameCount:int

The number of frames the sprite container has. This counts each set of directions as one frame.


Implementation
    public function get frameCount():int
    public function set frameCount(value:int):void
framesproperty 
protected var frames:Array = null

isLoadedproperty 
isLoaded:Boolean  [read-only]

True if the frames associated with this sprite container have been loaded.


Implementation
    public function get isLoaded():Boolean
modifiersproperty 
modifiers:Array

Array with BitmapData modifiers that will be pre-rendered


Implementation
    public function get modifiers():Array
    public function set modifiers(value:Array):void
rawFrameCountproperty 
rawFrameCount:int  [read-only]

The total number of frames the sprite container has. This counts each direction separately.


Implementation
    public function get rawFrameCount():int
Method Detail
buildFrames()method
protected function buildFrames():void

deleteFrames()method 
protected function deleteFrames():void

Deletes the frames so this class can be re-used with a new set of frames.

getFrame()method 
public function getFrame(index:int, direction:Number = 0.0):BitmapData

Gets the bitmap data for a frame at the specified index.

Parameters

index:int — The index of the frame to retrieve.
 
direction:Number (default = 0.0) — The direction of the frame to retrieve in degrees. This can be ignored if there is only 1 direction per frame.

Returns
BitmapData — The bitmap data for the specified frame, or null if it doesn't exist.
getRawFrame()method 
protected function getRawFrame(index:int):BitmapData

Gets the frame at the specified index. This does not take direction into account.

Parameters

index:int

Returns
BitmapData
getSourceFrames()method 
protected function getSourceFrames():Array

Subclasses must override this method and return an array of BitmapData objects.

Returns
Array