Created
April 15, 2011 03:18
-
-
Save doronkatz/921072 to your computer and use it in GitHub Desktop.
ArrayCollection FilterFunction in-line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init()"> | |
<mx:Script> | |
<![CDATA[ | |
import mx.collections.SortField; | |
import mx.collections.Sort; | |
import mx.collections.ArrayCollection; | |
[Bindable] | |
private var catFamilyAC:ArrayCollection; | |
[inject]private var model:ModelController; | |
private function init():void { | |
var cat:CATDTO; | |
/* Initialize and populate the ArrayCollection object. */ | |
catFamilyAC = new ArrayCollection(); | |
for each (var cat:CatDTO in model.otherArraySourceAC) { | |
catFamilyAC.addItem(cat); | |
} | |
} | |
... | |
/** As you can see, inline, I have added a function rather than having to add another function to link it up to */ | |
/** this one filters for duplicate cat_ids **/ | |
private function filterAC():void { | |
catFamilyAC.filterFunction = function(item:CatDTO):Boolean{ | |
return cats[item.CAT_ID] ? true : false; | |
} | |
} | |
... | |
]]> | |
</mx:Script> | |
... | |
</mx:Application> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment