When it instantiates the component, the Flex framework creates an initialization object (
) and passes it to the
"myvalue"}
method sets this property.
Clip parameters can take any number of comma-separated arguments. Flex stores the clip
parameters as an array. Every argument in the clip parameter definition must have a ":1" after it in
order for Flex to let you use it.
The following example creates the clip parameters
applyProperties()
var clipParameters:Object = { text: 1, html: 1, autoSize: 1};
function constructObject2(obj:Object):Void {
...
applyProperties(obj, Label.prototype.clipParameters);
}
The
applyProperties()
applyProperties(Object, Object):Void
Thus, when you have a component like the following:
class MyComponent extends UIComponent {
...
private var clipParameters:Object = {someProperty: 1};
private static var mergedClipParameters =
mx.core.UIObject.mergeClipParameters(MyComponent.prototype.
clipParameters,UIComponent.prototype.clipParameters);
public var someProperty:String;
...
}
You can do this:
function constuctObject2(initObj:Object) {
super.constructObject2(initObj);
this.applyProperties(initObj, clipParameters);
}
This example uses the bracket notation to get around type-checking. If it runs in Flash, the
constructObject2()
initialization. If it runs in Flex, it calls the
applies properties as required.
You can dynamically create a list of clip parameters using the
This method creates the list of clip parameters using ActionScript shorthand; for example:
static function mergeClipParameters(obj, par):Boolean {
for (var i in par) {
obj[i] = par[i];
}
return true;
}
constructObject2()
method from within the
method has the following signature:
method is never called and UIObject.init takes care of all property
constructObject2()
method. The
,
, and
text
html
autoSize
constructObject2()
method and this function
mergeClipParameters()
Writing the component's ActionScript code
{foo:
constructObject2()
, and then calls the
method:
method.
53
Need help?
Do you have a question about the FLEX - DEVELOPING COMPONENTS AND THEMES and is the answer not in the manual?
Questions and answers