Creating a custom RectBorder implementation
The RectBorder class is used as a border skin in most version 2 components. The default
implementations in both the Halo and Sample themes use ActionScript to draw the border. A
custom implementation must use ActionScript to register itself as the RectBorder implementation
and provide sizing functionality, but can use either ActionScript or graphic elements to represent
the visuals.
Each RectBorder implementation must adhere to the following requirements:
•
It must extend mx.skins.RectBorder or one of its subclasses.
•
It must provide an
return sizing information.
•
It must implement the
•
It must support all four standard styles, as well as the four special styles.
The implementation can reuse standard borders for special borders, as the Sample theme does.
•
It must register itself as the RectBorder implementation.
RectBorder global registration
All components look to a central location for a reference to the RectBorder class in use for the
document,
_global.styles.rectBorderClass
component should use a different RectBorder implementation. To customize RectBorder for a
component, you must rely on the
A custom RectBorder example
Both RectBorder implementations provided by the Halo theme and the Sample theme use the
ActionScript drawing API to draw the borders for different styles. The following example
demonstrates how to create a custom RectBorder implementation that utilizes graphic symbols
for its display.
To create a custom RectBorder implementation:
Create a new folder in the Classes/mx/skins folder corresponding to the custom package name
1.
you'll use for the custom border.
For this example, use myTheme.
Create a new AS file in the new folder, and save it as RectBorder.as.
2.
Copy the following ActionScript code to the new AS file:
3.
import mx.core.ext.UIObjectExtensions;
class mx.skins.myTheme.RectBorder extends mx.skins.RectBorder
{
static var symbolName:String = "RectBorder";
static var symbolOwner:Object = RectBorder;
var className:String = "RectBorder";
#include "../../core/ComponentVersion.as"
648
Chapter 6: Components Dictionary
property value or implement the
offset
method to draw or size the border.
drawBorder()
borderStyle
getBorderMetrics
. You cannot specify that an individual
style property.
method to
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?