Packagecom.pblabs.rendering2D.spritesheet
Classpublic class SWFSpriteSheetComponent
InheritanceSWFSpriteSheetComponent Inheritance SpriteContainerComponent Inheritance EntityComponent Inheritance Object

A class that is similar to the SpriteSheetComponent except the frames are loaded by rasterizing frames from a MovieClip rather than splitting a single image.



Public Properties
 PropertyDefined By
  bounds : Rectangle
[read-only] The bounds of the source MovieClip.
SWFSpriteSheetComponent
  cached : Boolean = true
When cached is set to true (the default) the rasterized frames are re-used by all instances of the SWFSpriteSheetComponent with the same values for swf, smoothing, and clipName.
SWFSpriteSheetComponent
 Inheritedcenter : Point
Specifies an offset so the sprite is centered correctly.
SpriteContainerComponent
 Inheritedcentered : Boolean
[read-only] Indicates that the spriteSheet has a centered alignment.
SpriteContainerComponent
  clipName : String
The name of the clip to instantiate from the SWF.
SWFSpriteSheetComponent
 InheriteddegreesPerDirection : Number
[read-only] The number of degrees separating each direction.
SpriteContainerComponent
 InheriteddirectionsPerFrame : Number = 1
The number of directions per frame.
SpriteContainerComponent
 InheritedframeCount : int
The number of frames the sprite container has.
SpriteContainerComponent
  isLoaded : Boolean
[override] [read-only]
SWFSpriteSheetComponent
 InheritedisRegistered : Boolean
[read-only] Whether or not the component is currently registered with an entity.
EntityComponent
 Inheritedmodifiers : 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
 InheritedrawFrameCount : int
[read-only] The total number of frames the sprite container has.
SpriteContainerComponent
  scale : Point
X/Y scaling for the SWF as it renders to bitmap.
SWFSpriteSheetComponent
  smoothing : Boolean
Whether or not the bitmaps that are drawn should be smoothed.
SWFSpriteSheetComponent
  swf : SWFResource
The SWF to be rasterized into frames.
SWFSpriteSheetComponent
Protected Properties
 PropertyDefined By
  _frameCache : Dictionary
[static]
SWFSpriteSheetComponent
 Inheritedframes : Array = null
SpriteContainerComponent
Public Methods
 MethodDefined By
 Inherited
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
 Inherited
SpriteContainerComponent
 Inherited
Deletes the frames so this class can be re-used with a new set of frames.
SpriteContainerComponent
  
getBitmapDataByDisplay(display:DisplayObject):BitmapData
Draws the DisplayObject to a BitmapData using the bounds of the object.
SWFSpriteSheetComponent
  
getCachedFrames():CachedFramesData
Reads the frames from the cache.
SWFSpriteSheetComponent
  
SWFSpriteSheetComponent
  
getRawFrame(index:int):BitmapData
[override]
SWFSpriteSheetComponent
  
[override] Rasterizes the associated MovieClip and returns a list of frames.
SWFSpriteSheetComponent
 Inherited
onAdd():void
This is called when the component is added to an entity.
EntityComponent
  
onRasterize(mc:MovieClip):Array
Performs the actual rasterizing.
SWFSpriteSheetComponent
 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
  
rasterize():void
Rasterizes the clip into an Array of BitmapData objects.
SWFSpriteSheetComponent
  
rasterizeFrame(mc:MovieClip, frameIndex:int):BitmapData
SWFSpriteSheetComponent
  
setCachedFrames(frames:CachedFramesData):void
Caches the frames based on the current values.
SWFSpriteSheetComponent
Property Detail
_frameCacheproperty
protected static var _frameCache:Dictionary

boundsproperty 
bounds:Rectangle  [read-only]

The bounds of the source MovieClip. This can be used for clips that are expected to be rendered based on their bounds.


Implementation
    public function get bounds():Rectangle
cachedproperty 
public var cached:Boolean = true

When cached is set to true (the default) the rasterized frames are re-used by all instances of the SWFSpriteSheetComponent with the same values for swf, smoothing, and clipName.

clipNameproperty 
clipName:String

The name of the clip to instantiate from the SWF. If this is null the root clip will be used.


Implementation
    public function get clipName():String
    public function set clipName(value:String):void
isLoadedproperty 
isLoaded:Boolean  [read-only] [override]


Implementation
    public function get isLoaded():Boolean
scaleproperty 
scale:Point

X/Y scaling for the SWF as it renders to bitmap. Value of (1, 1) mean no scaling (default). (0.5, 0.5) would be half the normal size, and (2, 2) would be double.


Implementation
    public function get scale():Point
    public function set scale(value:Point):void
smoothingproperty 
smoothing:Boolean

Whether or not the bitmaps that are drawn should be smoothed. Default is True.


Implementation
    public function get smoothing():Boolean
    public function set smoothing(value:Boolean):void
swfproperty 
swf:SWFResource

The SWF to be rasterized into frames.


Implementation
    public function get swf():SWFResource
    public function set swf(value:SWFResource):void
Method Detail
getBitmapDataByDisplay()method
protected function getBitmapDataByDisplay(display:DisplayObject):BitmapData

Draws the DisplayObject to a BitmapData using the bounds of the object.

Parameters

display:DisplayObject

Returns
BitmapData
getCachedFrames()method 
protected function getCachedFrames():CachedFramesData

Reads the frames from the cache. Returns a null reference if they are not cached.

Returns
CachedFramesData
getFramesCacheKey()method 
protected function getFramesCacheKey():String

Returns
String
getRawFrame()method 
override protected function getRawFrame(index:int):BitmapData

Parameters

index:int

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

Rasterizes the associated MovieClip and returns a list of frames.

Returns
Array
onRasterize()method 
protected function onRasterize(mc:MovieClip):Array

Performs the actual rasterizing. Override this to perform custom rasterizing of a clip.

Parameters

mc:MovieClip

Returns
Array
rasterize()method 
protected function rasterize():void

Rasterizes the clip into an Array of BitmapData objects. This array can then be used just like a sprite sheet.

rasterizeFrame()method 
protected function rasterizeFrame(mc:MovieClip, frameIndex:int):BitmapData

Parameters

mc:MovieClip
 
frameIndex:int

Returns
BitmapData
setCachedFrames()method 
protected function setCachedFrames(frames:CachedFramesData):void

Caches the frames based on the current values.

Parameters

frames:CachedFramesData