<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.controls.CheckBox;
[Bindable]
private var rpAr:Array=[{id:0,name:"name1"},{id:1,name:"name2"}];
private function selectAll():void{
for(var i:uint=0;i<rpAr.length;i++){
cb[i].selected=true;
}
//或者
/*
for(var i:uint=0;i<checkBox.length;i++){
cb[i].selected=true;
}
*/
}
]]>
</mx:Script>
<mx:Label text="全选" click="selectAll();">
</mx:Label>
<mx:Tile width="100%" direction="vertical" borderStyle="inset" horizontalGap="10" verticalGap="15">
<mx:Repeater id="rp" dataProvider="{rpAr}">
<mx:CheckBox id="cb" label="{rp.currentItem.name}"/>
</mx:Repeater>
</mx:Tile>
</mx:Application>
FLEX入门篇---------由Repeater创建的checkbox如何全选?
最新推荐文章于 2022-05-04 16:17:09 发布