一种方法是键入
value
财产作为
String
,为它编写getter和setter并在其中进行解析:
/**
* docs here
*/
[Bindable(event="valueChanged")]
public function get value():String
{
return _valueInt.toString();
}
/**
* @private
*/
public function set value(aVal:String):void
{
// parse the aVal String to an int (or whatever) here
_valueInt = parsed_aVal;
dispatchEvent(new Event("valueChanged"));
}
相关的注意事项是,框架组件通过使用名为
PercentProxy
. 下面的例子是
width
mx.core.UIComponent
:
[Bindable("widthChanged")]
[Inspectable(category="General")]
[PercentProxy("percentWidth")]
override public function get width():Number
{
// --snip snip--
}
override public function set width(value:Number):void
{
// --snip snip--
}