一种选择是直接输入value
属性作为String
,写一个getter和为它制定者和执行解析有:
/**
* 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
的未公开元数据字段,允许在MXML中分配时在某些大小特性中使用百分比符号。下面的例子是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--
}