如何在 Flash 列表控件中有一个复选框?
到目前为止我编码的内容:
CustomCellRenderer.as
package
{
import fl.controls.CheckBox;
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ListData;
public class CustomCellRenderer extends CheckBox implements ICellRenderer {
private var _listData:ListData;
private var _data:Object;
public function CustomCellRenderer() {
}
public function set data(d:Object):void {
_data = d;
label = d.label;
}
public function get data():Object {
return _data;
}
public function set listData(ld:ListData):void {
_listData = ld;
}
public function get listData():ListData {
return _listData;
}
}
}
Flash IDE 操作面板内部:
import fl.controls.List;
var myList:List
myList.allowMultipleSelection =true;
myList.setStyle("cellRenderer", CustomCellRenderer);
myList.addItem({label:"Burger", price:"$5.95"});
myList.addItem({label:"Fries", price:"$1.95"});
myList.addItem({label:"Burger", price:"$5.95"});
myList.addItem({label:"Fries", price:"$1.95"});
问题是显示的复选框,不能同时检查(除非单击 Ctrl 按钮)。
五。