Search Flex Components Free

Custom Search

December 27, 2007

Flex Data Collections Filter Functions With MLListCollections


<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx=""
backgroundAlpha="0" >


import mx.collections.*;

private var airportCollection:ArrayCollection;

private function xmlFilterFunc(item:Object):Boolean
item.@label >= "Inbox" && item.@label <= "Memos";


<mx:XML format="e4x" id="source">
<nodes label="Mail" data="mail" />
<nodes label="Inbox" data="inbox" />
<nodes label="Drafts" data="drafts" />
<nodes label="Memos" data="memos" />
<nodes label="Faxes" data="faxes" />

<mx:XMLListCollection id="xmlC" source="{source.nodes}" filterFunction="xmlFilterFunc" />

<mx:Label text="A filterFunction is used with an XMLListCollection." />
<mx:Label text="You should only see items from Inbox - Memos." />

<mx:DataGrid id="xmlDG" dataProvider="{xmlC}" >
<mx:DataGridColumn dataField="@label" headerText="folders"/>


Related Flex Tutorials