如何定義一個getter和seter設置的屬性可以被綁定
更新時間:2009年05月25日 18:43:12 作者:
Define private variable for maxFontSize.
// Define private variable for maxFontSize.
public var _maxFontSize:Number = 15;
// Define public getter method, mark the property
// as usable for the source of data binding,
// and specify the name of the binding event.
[Bindable("maxFontSizeChanged")]
public function get maxFontSize():Number {
return _maxFontSize;
}
// Define public setter method.
public function set maxFontSize(value:Number):void {
if (value <= 30) {
_maxFontSize = value;
} else _maxFontSize = 30;
// Dispatch the event to trigger data binding.
dispatchEvent(new Event("maxFontSizeChanged"));
}
public var _maxFontSize:Number = 15;
// Define public getter method, mark the property
// as usable for the source of data binding,
// and specify the name of the binding event.
[Bindable("maxFontSizeChanged")]
public function get maxFontSize():Number {
return _maxFontSize;
}
// Define public setter method.
public function set maxFontSize(value:Number):void {
if (value <= 30) {
_maxFontSize = value;
} else _maxFontSize = 30;
// Dispatch the event to trigger data binding.
dispatchEvent(new Event("maxFontSizeChanged"));
}
相關文章
Flex和.NET協(xié)同開發(fā)利器FluorineFx Flex與.NET互操作
在本系列前面幾篇文章中分別介紹了通過WebService、HTTPService、URLLoader以及FielReference等組件或類來完成Flex與.NET服務端的通信的相關知識點。2009-06-06
Flex結(jié)合JavaScript讀取本地路徑的方法
鑒于adobe并沒有提供FileReference對瀏覽的文件的完整路徑的接口。只能采用JS和fileinput控件來獲取本地路徑了。2009-02-02
Flex Gumbo 通過smooth屬性設置BitmapGraphic對象平滑度的例子
接下來的例子演示了Flex Gumbo中如何通過smooth屬性,設置BitmapGraphic對象平滑度。2009-06-06

