代码如下:
package { import fl.controls.CheckBox; import fl.controls.listClasses.ICellRenderer; import fl.controls.listClasses.ListData; import flash.events.Event; import fl.core.InvalidationType; public class CheckBoxRenderer extends CheckBox implements ICellRenderer { private var _listData:ListData; private var _data:Object; public function CheckBoxRenderer(){ super(); addEventListener(Event.CHANGE, onCheckChange); } public function set data(d:Object):void{ _data = d; label = ""; _selected = (_data["checked"]=='true')?true:false; } public function get data():Object { return _data; } public function get selectedItem():Object { return _data; } public function get listData():ListData { return _listData; } public function set listData(value:ListData):void { _listData = value; } override public function get selected():Boolean { return _selected; } override public function set selected(value:Boolean):void { } public function onCheckChange(e:Event) { _selected = !_selected; _data["checked"] = (_selected==true)?'true':'false'; } } }