Packagemx.skins
Classpublic class ProgrammaticSkin
InheritanceProgrammaticSkin Inheritance FlexShape Inheritance flash.display.Shape
Implements IFlexDisplayObject, IInvalidating, ILayoutManagerClient, ISimpleStyleClient, IProgrammaticSkin
Subclasses AdvancedDataGridHeaderHorizontalSeparator, ApplicationBackground, ApplicationTitleBarBackgroundSkin, AreaRenderer, Border, BoxItemRenderer, BrokenImageBorderSkin, CandlestickItemRenderer, CircleItemRenderer, CrossItemRenderer, DataGridColumnDropIndicator, DataGridColumnResizeSkin, DataGridHeaderBackgroundSkin, DataGridHeaderSeparator, DataGridSortArrow, DataGridSortArrow, DateChooserIndicator, DiamondItemRenderer, HaloFocusRect, HLOCItemRenderer, LineRenderer, LinkSeparator, ListDropIndicator, ListDropIndicator, PopUpIcon, ProgressMaskSkin, ProgressMaskSkin, ShadowBoxItemRenderer, ShadowLineRenderer, StatusBarBackgroundSkin, TitleBackground, TriangleItemRenderer, WedgeItemRenderer, WindowBackground

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

This class is the base class for skin elements which draw themselves programmatically.



Public Properties
 PropertyDefined By
  initialized : Boolean
A flag that determines if an object has been through all three phases of layout: commitment, measurement, and layout (provided that any were required).
ProgrammaticSkin
  measuredHeight : Number
[read-only] The measured height of this object.
ProgrammaticSkin
  measuredWidth : Number
[read-only] The measured width of this object.
ProgrammaticSkin
  nestLevel : int
Depth of this object in the containment hierarchy.
ProgrammaticSkin
  processedDescriptors : Boolean
Set to true after immediate or deferred child creation, depending on which one happens.
ProgrammaticSkin
  styleName : Object
A parent component used to obtain style values.
ProgrammaticSkin
  updateCompletePendingFlag : Boolean
A flag that determines if an object has been through all three phases of layout validation (provided that any were required).
ProgrammaticSkin
Public Methods
 MethodDefined By
  
Constructor.
ProgrammaticSkin
  
getStyle(styleProp:String):*
Returns the value of the specified style property.
ProgrammaticSkin
  
Marks a component so that its updateDisplayList() method gets called during a later screen update.
ProgrammaticSkin
  
Calling this method results in a call to the component's validateProperties() method before the display list is rendered.
ProgrammaticSkin
  
Calling this method results in a call to the component's validateSize() method before the display list is rendered.
ProgrammaticSkin
  
move(x:Number, y:Number):void
Moves this object to the specified x and y coordinates.
ProgrammaticSkin
  
setActualSize(newWidth:Number, newHeight:Number):void
Sets the height and width of this object.
ProgrammaticSkin
  
styleChanged(styleProp:String):void
Whenever any style changes, redraw this skin.
ProgrammaticSkin
 Inherited
toString():String
[override] Returns a string indicating the location of this object within the hierarchy of DisplayObjects in the Application.
FlexShape
  
This function is called by the LayoutManager when it's time for this control to draw itself.
ProgrammaticSkin
  
Validate and update the properties and layout of this object and redraw it, if necessary.
ProgrammaticSkin
  
This function is an empty stub so that ProgrammaticSkin can implement the ILayoutManagerClient interface.
ProgrammaticSkin
  
validateSize(recursive:Boolean = false):void
This function is an empty stub so that ProgrammaticSkin can implement the ILayoutManagerClient interface.
ProgrammaticSkin
Protected Methods
 MethodDefined By
  
drawRoundRect(x:Number, y:Number, width:Number, height:Number, cornerRadius:Object = null, color:Object = null, alpha:Object = null, gradientMatrix:Matrix = null, gradientType:String = linear, gradientRatios:Array = null, hole:Object = null):void
Programatically draws a rectangle into this skin's Graphics object.
ProgrammaticSkin
  
horizontalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix
Utility function to create a horizontal gradient matrix.
ProgrammaticSkin
  
rotatedGradientMatrix(x:Number, y:Number, width:Number, height:Number, rotation:Number):Matrix
Utility function to create a rotated gradient matrix.
ProgrammaticSkin
  
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Programmatically draws the graphics for this skin.
ProgrammaticSkin
  
verticalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix
Utility function to create a vertical gradient matrix.
ProgrammaticSkin
Property Detail
initializedproperty
initialized:Boolean

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

A flag that determines if an object has been through all three phases of layout: commitment, measurement, and layout (provided that any were required).


Implementation
    public function get initialized():Boolean
    public function set initialized(value:Boolean):void
measuredHeightproperty 
measuredHeight:Number  [read-only]

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

The measured height of this object. This should be overridden by subclasses to return the preferred height for the skin.


Implementation
    public function get measuredHeight():Number
measuredWidthproperty 
measuredWidth:Number  [read-only]

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

The measured width of this object. This should be overridden by subclasses to return the preferred width for the skin.


Implementation
    public function get measuredWidth():Number
nestLevelproperty 
nestLevel:int

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

Depth of this object in the containment hierarchy. This number is used by the measurement and layout code. The value is 0 if this component is not on the DisplayList.


Implementation
    public function get nestLevel():int
    public function set nestLevel(value:int):void
processedDescriptorsproperty 
processedDescriptors:Boolean

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

Set to true after immediate or deferred child creation, depending on which one happens. For a Container object, it is set to true at the end of the createComponentsFromDescriptors() method, meaning after the Container object creates its children from its child descriptors.

For example, if an Accordion container uses deferred instantiation, the processedDescriptors property for the second pane of the Accordion container does not become true until after the user navigates to that pane and the pane creates its children. But, if the Accordion had set the creationPolicy property to "all", the processedDescriptors property for its second pane is set to true during application startup.

For classes that are not containers, which do not have descriptors, it is set to true after the createChildren() method creates any internal component children.


Implementation
    public function get processedDescriptors():Boolean
    public function set processedDescriptors(value:Boolean):void
styleNameproperty 
styleName:Object

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

A parent component used to obtain style values. This is typically set to the component that created this skin.


Implementation
    public function get styleName():Object
    public function set styleName(value:Object):void
updateCompletePendingFlagproperty 
updateCompletePendingFlag:Boolean

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

A flag that determines if an object has been through all three phases of layout validation (provided that any were required).


Implementation
    public function get updateCompletePendingFlag():Boolean
    public function set updateCompletePendingFlag(value:Boolean):void
Constructor Detail
ProgrammaticSkin()Constructor
public function ProgrammaticSkin()

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

Constructor.

Method Detail
drawRoundRect()method
protected function drawRoundRect(x:Number, y:Number, width:Number, height:Number, cornerRadius:Object = null, color:Object = null, alpha:Object = null, gradientMatrix:Matrix = null, gradientType:String = linear, gradientRatios:Array = null, hole:Object = null):void

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

Programatically draws a rectangle into this skin's Graphics object.

The rectangle can have rounded corners. Its edges are stroked with the current line style of the Graphics object. It can have a solid color fill, a gradient fill, or no fill. A solid fill can have an alpha transparency. A gradient fill can be linear or radial. You can specify up to 15 colors and alpha values at specified points along the gradient, and you can specify a rotation angle or transformation matrix for the gradient. Finally, the rectangle can have a rounded rectangular hole carved out of it.

This versatile rectangle-drawing routine is used by many skins. It calls the drawRect() or drawRoundRect() methods (in the flash.display.Graphics class) to draw into this skin's Graphics object.

Parameters

x:Number — Horizontal position of upper-left corner of rectangle within this skin.
 
y:Number — Vertical position of upper-left corner of rectangle within this skin.
 
width:Number — Width of rectangle, in pixels.
 
height:Number — Height of rectangle, in pixels.
 
cornerRadius:Object (default = null) — Corner radius/radii of rectangle. Can be null, a Number, or an Object. If it is null, it specifies that the corners should be square rather than rounded. If it is a Number, it specifies the same radius, in pixels, for all four corners. If it is an Object, it should have properties named tl, tr, bl, and br, whose values are Numbers specifying the radius, in pixels, for the top left, top right, bottom left, and bottom right corners. For example, you can pass a plain Object such as { tl: 5, tr: 5, bl: 0, br: 0 }. The default value is null (square corners).
 
color:Object (default = null) — The RGB color(s) for the fill. Can be null, a uint, or an Array. If it is null, the rectangle not filled. If it is a uint, it specifies an RGB fill color. For example, pass 0xFF0000 to fill with red. If it is an Array, it should contain uints specifying the gradient colors. For example, pass [ 0xFF0000, 0xFFFF00, 0x0000FF ] to fill with a red-to-yellow-to-blue gradient. You can specify up to 15 colors in the gradient. The default value is null (no fill).
 
alpha:Object (default = null) — Alpha value(s) for the fill. Can be null, a Number, or an Array. This argument is ignored if color is null. If color is a uint specifying an RGB fill color, then alpha should be a Number specifying the transparency of the fill, where 0.0 is completely transparent and 1.0 is completely opaque. You can also pass null instead of 1.0 in this case to specify complete opaqueness. If color is an Array specifying gradient colors, then alpha should be an Array of Numbers, of the same length, that specifies the corresponding alpha values for the gradient. In this case, the default value is null (completely opaque).
 
gradientMatrix:Matrix (default = null) — Matrix object used for the gradient fill. The utility methods horizontalGradientMatrix(), verticalGradientMatrix(), and rotatedGradientMatrix() can be used to create the value for this parameter.
 
gradientType:String (default = linear) — Type of gradient fill. The possible values are GradientType.LINEAR or GradientType.RADIAL. (The GradientType class is in the package flash.display.)
 
gradientRatios:Array (default = null) — (optional default [0,255]) Specifies the distribution of colors. The number of entries must match the number of colors defined in the color parameter. Each value defines the percentage of the width where the color is sampled at 100%. The value 0 represents the left-hand position in the gradient box, and 255 represents the right-hand position in the gradient box.
 
hole:Object (default = null) — (optional) A rounded rectangular hole that should be carved out of the middle of the otherwise solid rounded rectangle { x: #, y: #, w: #, h: #, r: # or { br: #, bl: #, tl: #, tr: # } }

See also

flash.display.Graphics.beginGradientFill()
getStyle()method 
public function getStyle(styleProp:String):*

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

Returns the value of the specified style property.

Parameters

styleProp:String — Name of the style property.

Returns
* — The style value. This can be any type of object that style properties can be, such as int, Number, String, etc.
horizontalGradientMatrix()method 
protected function horizontalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix

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

Utility function to create a horizontal gradient matrix.

Parameters

x:Number — The left edge of the gradient.
 
y:Number — The top edge of the gradient.
 
width:Number — The width of the gradient.
 
height:Number — The height of the gradient.

Returns
Matrix — The horizontal gradient matrix. This is a temporary object that should only be used for a single subsequent call to the drawRoundRect() method.
invalidateDisplayList()method 
public function invalidateDisplayList():void

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

Marks a component so that its updateDisplayList() method gets called during a later screen update.

Invalidation is a useful mechanism for eliminating duplicate work by delaying processing of changes to a component until a later screen update. For example, if you want to change the width and height, it would be wasteful to update the component immediately after you change the width and then update again with the new height. It is more efficient to change both properties and then render the component with its new size once.

Invalidation methods rarely get called. In general, setting a property on a component automatically calls the appropriate invalidation method.

invalidateProperties()method 
public function invalidateProperties():void

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

Calling this method results in a call to the component's validateProperties() method before the display list is rendered.

For components that extend UIComponent, this implies that commitProperties() is called.

invalidateSize()method 
public function invalidateSize():void

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

Calling this method results in a call to the component's validateSize() method before the display list is rendered.

For components that extend UIComponent, this implies that measure() is called, unless the component has both explicitWidth and explicitHeight set.

move()method 
public function move(x:Number, y:Number):void

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

Moves this object to the specified x and y coordinates.

Parameters

x:Number — The horizontal position, in pixels.
 
y:Number — The vertical position, in pixels.

rotatedGradientMatrix()method 
protected function rotatedGradientMatrix(x:Number, y:Number, width:Number, height:Number, rotation:Number):Matrix

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

Utility function to create a rotated gradient matrix.

Parameters

x:Number — The left edge of the gradient.
 
y:Number — The top edge of the gradient.
 
width:Number — The width of the gradient.
 
height:Number — The height of the gradient.
 
rotation:Number — The amount to rotate, in degrees.

Returns
Matrix — The horizontal gradient matrix. This is a temporary object that should only be used for a single subsequent call to the drawRoundRect() method.
setActualSize()method 
public function setActualSize(newWidth:Number, newHeight:Number):void

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

Sets the height and width of this object.

Parameters

newWidth:Number — The width, in pixels, of this object.
 
newHeight:Number — The height, in pixels, of this object.

styleChanged()method 
public function styleChanged(styleProp:String):void

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

Whenever any style changes, redraw this skin. Subclasses can override this method and perform a more specific test before calling invalidateDisplayList().

Parameters

styleProp:String — The name of the style property that changed, or null if all styles have changed.

updateDisplayList()method 
protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

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

Programmatically draws the graphics for this skin.

Subclasses should override this method and include calls to methods such as graphics.moveTo() and graphics.lineTo().

This occurs before any scaling from sources such as user code or zoom effects. The component is unaware of the scaling that takes place later.

Parameters

unscaledWidth:Number — The width, in pixels, of this object before any scaling.
 
unscaledHeight:Number — The height, in pixels, of this object before any scaling.

validateDisplayList()method 
public function validateDisplayList():void

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

This function is called by the LayoutManager when it's time for this control to draw itself. The actual drawing happens in the updateDisplayList function, which is called by this function.

validateNow()method 
public function validateNow():void

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

Validate and update the properties and layout of this object and redraw it, if necessary.

validateProperties()method 
public function validateProperties():void

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

This function is an empty stub so that ProgrammaticSkin can implement the ILayoutManagerClient interface. Skins do not call LayoutManager.invalidateProperties(), which would normally trigger a call to this method.

validateSize()method 
public function validateSize(recursive:Boolean = false):void

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

This function is an empty stub so that ProgrammaticSkin can implement the ILayoutManagerClient interface. Skins do not call LayoutManager.invalidateSize(), which would normally trigger a call to this method.

Parameters

recursive:Boolean (default = false) — Determines whether children of this skin are validated.

verticalGradientMatrix()method 
protected function verticalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix

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

Utility function to create a vertical gradient matrix.

Parameters

x:Number — The left edge of the gradient.
 
y:Number — The top edge of the gradient.
 
width:Number — The width of the gradient.
 
height:Number — The height of the gradient.

Returns
Matrix — The horizontal gradient matrix. This is a temporary object that should only be used for a single subsequent call to the drawRoundRect() method.