ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
mx.graphics 

RectangularDropShadow  - AS3 Flex

Packagemx.graphics
Classpublic class RectangularDropShadow
InheritanceRectangularDropShadow Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Drop shadows are typically created using the DropShadowFilter class. However, the DropShadowFilter, like all bitmap filters, can be computationally expensive. If the DropShadowFilter is applied to a DisplayObject, then the drop shadow is recalculated whenever the appearance of the object changes. If the DisplayObject is animated (using a Resize effect, for example), then the presence of drop shadows hurts the animation refresh rate.

This class optimizes drop shadows for a common case. If you are applying a drop shadow to a rectangularly-shaped object whose edges fall on pixel boundaries, then this class should be used instead of using the DropShadowFilter directly.

This class accepts the first four parameters that are passed to DropShadowFilter: alpha, angle, color, and distance. In addition, this class accepts the corner radii for each of the four corners of the rectangularly-shaped object that is casting a shadow.

Once those 8 values have been set, this class pre-computes the drop shadow in an offscreen Bitmap. When the drawShadow() method is called, pieces of the precomputed drop shadow are copied onto the passed-in Graphics object.

Related API Elements



Public Properties
 PropertyDefined By
  alpha : Number
The alpha transparency value for the shadow color.
RectangularDropShadow
  angle : Number
The angle of the shadow.
RectangularDropShadow
  blRadius : Number
The corner radius of the bottom left corner of the rounded rectangle that is casting the shadow.
RectangularDropShadow
  blurX : Number
The amount of horizontal blur.
RectangularDropShadow
  blurY : Number
The amount of vertical blur.
RectangularDropShadow
  brRadius : Number
The corner radius of the bottom right corner of the rounded rectangle that is casting the shadow.
RectangularDropShadow
  color : int
The color of the shadow.
RectangularDropShadow
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  distance : Number
The offset distance for the shadow, in pixels.
RectangularDropShadow
  tlRadius : Number
The corner radius of the top left corner of the rounded rectangle that is casting the shadow.
RectangularDropShadow
  trRadius : Number
The corner radius of the top right corner of the rounded rectangle that is casting the shadow.
RectangularDropShadow
Public Methods
 MethodDefined By
  
Constructor.
RectangularDropShadow
  
Renders the shadow on the screen.
RectangularDropShadow
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

alpha

property
alpha:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The alpha transparency value for the shadow color. Valid values are 0.0 to 1.0. For example, .25 sets a transparency value of 25%. The default value is 1.0.



Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void

angle

property 
angle:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The angle of the shadow. Valid values are 0 to 360 degrees (floating point). The default value is 45.



Implementation
    public function get angle():Number
    public function set angle(value:Number):void

blRadius

property 
blRadius:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The corner radius of the bottom left corner of the rounded rectangle that is casting the shadow. May be zero for non-rounded rectangles.



Implementation
    public function get blRadius():Number
    public function set blRadius(value:Number):void

blurX

property 
blurX:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 9, AIR 1.1

The amount of horizontal blur.

The default value is 4.



Implementation
    public function get blurX():Number
    public function set blurX(value:Number):void

blurY

property 
blurY:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 9, AIR 1.1

The amount of vertical blur.

The default value is 4.



Implementation
    public function get blurY():Number
    public function set blurY(value:Number):void

brRadius

property 
brRadius:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The corner radius of the bottom right corner of the rounded rectangle that is casting the shadow. May be zero for non-rounded rectangles.



Implementation
    public function get brRadius():Number
    public function set brRadius(value:Number):void

color

property 
color:int

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The color of the shadow. Valid values are in hexadecimal format 0xRRGGBB. The default value is 0x000000.



Implementation
    public function get color():int
    public function set color(value:int):void

distance

property 
distance:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The offset distance for the shadow, in pixels. The default value is 4.0 (floating point).



Implementation
    public function get distance():Number
    public function set distance(value:Number):void

tlRadius

property 
tlRadius:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The corner radius of the top left corner of the rounded rectangle that is casting the shadow. May be zero for non-rounded rectangles.



Implementation
    public function get tlRadius():Number
    public function set tlRadius(value:Number):void

trRadius

property 
trRadius:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The corner radius of the top right corner of the rounded rectangle that is casting the shadow. May be zero for non-rounded rectangles.



Implementation
    public function get trRadius():Number
    public function set trRadius(value:Number):void
Constructor Detail

RectangularDropShadow

()Constructor
public function RectangularDropShadow()

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Constructor.

Method Detail

drawShadow

()method
public function drawShadow(g:Graphics, x:Number, y:Number, width:Number, height:Number):void

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Renders the shadow on the screen.

Parameters

g:Graphics — The Graphics object on which to draw the shadow.
 
x:Number — The horizontal offset of the drop shadow, based on the Graphics object's position.
 
y:Number — The vertical offset of the drop shadow, based on the Graphics object's position.
 
width:Number — The width of the shadow, in pixels.
 
height:Number — The height of the shadow, in pixels.