September 10th, 2007 by Kyle
Tags: arraycollection, Flex, idropinlistitemrenderer, itemrenderer, tilelist, toggle, toggle-buttons, togglebutton, uuid
Posted in: Flex
I had a customer ask how they could use a button itemRenderer in a tile list, have the buttons toggle, and keep track of all the toggled buttons so one could easily clear all the toggled buttons. Here is what I came up with:
The key to this is that if your TileList has a dataprovider that is an array collection, within an itemRenderer, each item’s BaseListData will have a UUID.
If you extend the Tilelist and add a public member that is an arrayCollection that is used to contain all the UUIDs of toggled buttons, then management of those toggled buttons become quite easy.
Here is my simple extension to TileList:
<mx:TileList xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="acToggledButtons = new ArrayCollection()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var acToggledButtons:ArrayCollection;
public function removeAll():void{
acToggledButtons.removeAll();
this.invalidateList();
}
]]>
</mx:Script>
</mx:TileList>
1 Comment »

Recent Comments