Packagecom.flashdynamix.motion.layers
Classpublic class BitmapLayer
InheritanceBitmapLayer Inheritance flash.display.Bitmap

The BitmapLayer class draws the IEffects in its list into a single BitmapData.
Drawing to a Bitmap can result in significant frame rate improvements when the number of DisplayObjects is high, the number of filters is high or the type of filters used are processor intensive.



Public Properties
 PropertyDefined by
  bgColor : uint
The hexadecimal color defining the color for the BitmapData.
BitmapLayer
  clearOnRender : Boolean = false
If this is set to true then on each render the BitmapData will be filled with the bgColor.
BitmapLayer
  layerHeight : int
BitmapLayer
  layerWidth : int
BitmapLayer
  length : int
[read-only]
BitmapLayer
  list : Array
The list of IEffects to be drawn on each render.
BitmapLayer
  scale : Number
BitmapLayer
  smoothing : Boolean
BitmapLayer
  transparent : Boolean = false
Whether the BitmapData uses transparency.
BitmapLayer
Public Methods
 MethodDefined by
  
BitmapLayer(width:Number = 500, height:Number = 500, scale:Number = 1, bgColor:uint = 0x00FFFFFF, transparent:Boolean = true, smoothing:Boolean = false)
BitmapLayer
  
add(effect:IEffect):IEffect
Adds an IEffect into the list.
BitmapLayer
  
clear():void
Removes all IEffects from the list.
BitmapLayer
  
dispose():void
Disposes the BitmapLayer read for garbage collection
BitmapLayer
  
draw(instance:IBitmapDrawable, matrix:Matrix = null, rectangle:Rectangle = null, colorTransform:ColorTransform = null, blendMode:String = "normal"):DrawEffect
Adds a DrawEffect for the specified IBitmapDrawable to the render list.
BitmapLayer
  
item(index:int):IEffect
Returns an IEffect from the list at the specified index.
BitmapLayer
  
remove(effect:IEffect):Boolean
Removes an IEffect from the list.
BitmapLayer
  
render(e:Event = null):void
Renders all IEffects in the list.
BitmapLayer
  
startRender():void
Starts rendering the BitmapLayer on construction rendering automatically starts.
BitmapLayer
  
stopRender():void
Stops rendering the BitmapLayer this can be resumed via the startRender method.
BitmapLayer
  
toString():String
BitmapLayer
Protected Methods
 MethodDefined by
  
addEvent(item:EventDispatcher, type:String, listener:Function, priority:int = 0, useWeakReference:Boolean = true):void
BitmapLayer
  
removeEvent(item:EventDispatcher, type:String, listener:Function):void
BitmapLayer
  
BitmapLayer
Property detail
bgColorproperty
public var bgColor:uint

The hexadecimal color defining the color for the BitmapData.

clearOnRenderproperty 
public var clearOnRender:Boolean = false

If this is set to true then on each render the BitmapData will be filled with the bgColor.

layerHeightproperty 
layerHeight:int  [read-write]Implementation
    public function get layerHeight():int
    public function set layerHeight(value:int):void
layerWidthproperty 
layerWidth:int  [read-write]Implementation
    public function get layerWidth():int
    public function set layerWidth(value:int):void
lengthproperty 
length:int  [read-only]

Implementation
    public function get length():int
listproperty 
public var list:Array

The list of IEffects to be drawn on each render.

scaleproperty 
scale:Number  [read-write]Implementation
    public function get scale():Number
    public function set scale(value:Number):void
smoothingproperty 
smoothing:Boolean  [read-write]Implementation
    public function get smoothing():Boolean
    public function set smoothing(value:Boolean):void
transparentproperty 
public var transparent:Boolean = false

Whether the BitmapData uses transparency.

Constructor detail
BitmapLayer()constructor
public function BitmapLayer(width:Number = 500, height:Number = 500, scale:Number = 1, bgColor:uint = 0x00FFFFFF, transparent:Boolean = true, smoothing:Boolean = false)

Parameters
width:Number (default = 500) — The width in pixels to render the BitmapLayer.
 
height:Number (default = 500) — The height in pixels to render the BitmapLayer.
 
scale:Number (default = 1) — The scale to render the BitmapLayer.
 
bgColor:uint (default = 0x00FFFFFF) — The hexadecimal bgColor to render the BitmapData background color.
 
transparent:Boolean (default = true) — Whether the BitmapData uses transparency. Not using transparency can reduce artifacts on the BitmapData when using BlendModes like BlendMode.ADD or BlendMode.OVERLAY
 
smoothing:Boolean (default = false) — Whether the BitmapData uses pixel smoothing. This is useful if the BitmapLayer is animated.
Method detail
add()method
public function add(effect:IEffect):IEffect

Adds an IEffect into the list.

Parameters
effect:IEffect

Returns
IEffect
addEvent()method 
protected function addEvent(item:EventDispatcher, type:String, listener:Function, priority:int = 0, useWeakReference:Boolean = true):voidParameters
item:EventDispatcher
 
type:String
 
listener:Function
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = true)
clear()method 
public function clear():void

Removes all IEffects from the list.

dispose()method 
public function dispose():void

Disposes the BitmapLayer read for garbage collection

draw()method 
public function draw(instance:IBitmapDrawable, matrix:Matrix = null, rectangle:Rectangle = null, colorTransform:ColorTransform = null, blendMode:String = "normal"):DrawEffect

Adds a DrawEffect for the specified IBitmapDrawable to the render list.

Parameters
instance:IBitmapDrawable — The IBitmapDrawable instance which will be used in the DrawEffect.
 
matrix:Matrix (default = null) — The translation Matrix used with the DrawEffect.
 
rectangle:Rectangle (default = null) — The clipping Rectangle used with the DrawEffect.
 
colorTransform:ColorTransform (default = null) — The ColorTransform used with the DrawEffect.
 
blendMode:String (default = "normal") — The BlendMode used with the DrawEffect.

Returns
DrawEffect
item()method 
public function item(index:int):IEffect

Returns an IEffect from the list at the specified index.

Parameters
index:int

Returns
IEffect
remove()method 
public function remove(effect:IEffect):Boolean

Removes an IEffect from the list.

Parameters
effect:IEffect

Returns
Boolean
removeEvent()method 
protected function removeEvent(item:EventDispatcher, type:String, listener:Function):voidParameters
item:EventDispatcher
 
type:String
 
listener:Function
render()method 
public function render(e:Event = null):void

Renders all IEffects in the list. Triggering this method manually can be handy when confronting a situation where the renders do not need to be done on a ENTER_FRAME basis or the developer would like custom control over when the render cycles occur.

Parameters
e:Event (default = null)
startRender()method 
public function startRender():void

Starts rendering the BitmapLayer on construction rendering automatically starts.

stopRender()method 
public function stopRender():void

Stops rendering the BitmapLayer this can be resumed via the startRender method.

toString()method 
public override function toString():String

Returns
String
updateEffects()method 
protected function updateEffects():void