Packagecom.joebillman.fx
Classpublic class Reflection
InheritanceReflection Inheritance flash.display.Sprite

Reflection: This class dynamically creates a reflection for the display object that it is passed

View the examples



Public Properties
 PropertyDefined By
  filters : Array
[override] [write-only] Sets the filters array reflection
Reflection
  maskHeight : Number
[write-only] Sets the height of the mask
Reflection
  maskPaddingX : Number
[write-only] Sets the horizontal padding of the mask.
Reflection
  maskPaddingY : Number
[write-only] Sets the vertical padding of the mask
Reflection
  spread : Array
[write-only] Sets the spread array for the mask gradient
Reflection
  target : DisplayObject
[write-only] Sets the target for the reflection
Reflection
  transparency : Array
[write-only] Sets the transparency array for the mask gradient
Reflection
Public Methods
 MethodDefined By
  
Reflection(target:DisplayObject)
Reflection
  
cleanUp():void
Removes the mask and bitmap and marks them for deletion via the garbage collector
Reflection
  
redraw():void
Calls the cleanUp function and redraws the bitmap and mask
Reflection
Property Detail
filtersproperty
filters:Array  [write-only] [override]

Sets the filters array reflection

The default value is [].


Implementation
    public function set filters(value:Array):void
maskHeightproperty 
maskHeight:Number  [write-only]

Sets the height of the mask

The default value is target.height/2.


Implementation
    public function set maskHeight(value:Number):void
maskPaddingXproperty 
maskPaddingX:Number  [write-only]

Sets the horizontal padding of the mask. Most useful for text

The default value is 0.


Implementation
    public function set maskPaddingX(value:Number):void
maskPaddingYproperty 
maskPaddingY:Number  [write-only]

Sets the vertical padding of the mask

The default value is 0.


Implementation
    public function set maskPaddingY(value:Number):void
spreadproperty 
spread:Array  [write-only]

Sets the spread array for the mask gradient

The default value is [0, 127, 255].


Implementation
    public function set spread(value:Array):void
targetproperty 
target:DisplayObject  [write-only]

Sets the target for the reflection


Implementation
    public function set target(value:DisplayObject):void
transparencyproperty 
transparency:Array  [write-only]

Sets the transparency array for the mask gradient

The default value is [.75, .55, 0].


Implementation
    public function set transparency(value:Array):void
Constructor Detail
Reflection()Constructor
public function Reflection(target:DisplayObject)

Parameters
target:DisplayObject — Display object of which to make a reflection
Method Detail
cleanUp()method
public function cleanUp():void

Removes the mask and bitmap and marks them for deletion via the garbage collector

redraw()method 
public function redraw():void

Calls the cleanUp function and redraws the bitmap and mask

Examples
The following example creates a small red square and it's reflection.

Note: Due to an issue with the BitmapData class the target DisplayObject must have a top-left registration point of 0,0

    var reflection:Reflection;
    var shape:Shape = new Shape();
    var gr:Graphics = shape.graphics;
    
    gr.beginFill(0xFF0000);
    gr.drawRect(0, 0, 50, 50)
    gr.endFill();
    addChild(shape);
    reflection = new Reflection(shape);
    addChild(reflection);