package
{
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
[Bindable]
public class ItemVO extends EventDispatcher
{
public var label : String;
public var checked : Boolean;
}
}
{
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
[Bindable]
public class ItemVO extends EventDispatcher
{
public var label : String;
public var checked : Boolean;
}
}
Создать CheckBoxItemRender.mxml с кодом:
<?xml version="1.0" encoding="utf-8"?>
<?xml:namespace prefix = mx /><mx:canvas height="20" width="100" mx="http://www.adobe.com/2006/mxml">
<mx:checkbox id="checker" change="{data.checked = checker.selected}" selected="{data.checked}" label="{data.label}"></mx:checkbox>
</mx:canvas>
<?xml:namespace prefix = mx /><mx:canvas height="20" width="100" mx="http://www.adobe.com/2006/mxml">
<mx:checkbox id="checker" change="{data.checked = checker.selected}" selected="{data.checked}" label="{data.label}"></mx:checkbox>
</mx:canvas>
Создать ComponentListTest.mxml с кодом:
<?xml version="1.0" encoding="utf-8"?>
<!-- Tree control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" layout="vertical">
<mx:Script>
<![CDATA[
public function clearItems() : void
{
for (var i : Number=0; i<arcoltest.length; i++)
{
arcoltest.getItemAt(i).checked = false;
}
}
]]>
</mx:Script>
<mx:ArrayCollection id="arcoltest">
<local:ItemVO label="qewqw" checked="true" />
<local:ItemVO label="1" checked="true" />
<local:ItemVO label="2" checked="true" />
<local:ItemVO label="1231" checked="true" />
<local:ItemVO label="qweqwe" checked="true" />
</mx:ArrayCollection>
<mx:List dataProvider="{arcoltest}" itemRenderer="CheckBoxItemRender" />
<mx:Button label="Clear all" click="clearItems()"/>
</mx:Application>
<!-- Tree control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" layout="vertical">
<mx:Script>
<![CDATA[
public function clearItems() : void
{
for (var i : Number=0; i<arcoltest.length; i++)
{
arcoltest.getItemAt(i).checked = false;
}
}
]]>
</mx:Script>
<mx:ArrayCollection id="arcoltest">
<local:ItemVO label="qewqw" checked="true" />
<local:ItemVO label="1" checked="true" />
<local:ItemVO label="2" checked="true" />
<local:ItemVO label="1231" checked="true" />
<local:ItemVO label="qweqwe" checked="true" />
</mx:ArrayCollection>
<mx:List dataProvider="{arcoltest}" itemRenderer="CheckBoxItemRender" />
<mx:Button label="Clear all" click="clearItems()"/>
</mx:Application>
Комментариев нет:
Отправить комментарий