This content has been marked as final. Show 3 replies
Nobody has any idea how to accomplish this? Why is this so hard... I feel like nobone here understands flex outside of cookie-cutter applications. Its frustrating to have to dig through source code every time one want to do something simple but not supported out of the box.
var tempArrayCollection:ArrayCollection = new ArrayCollection();
if(arrayCollectionName.length < 5)
j = arrayCollectionName.length
j = 5
for(i = 0; i < j; i++)
Thanks Saggot. I probably should have said that I was looking for an encapsulated solution because my application was complex (multiple ArrayCollections feeding on a single source).
Anyway heres my solution
public class Top5ArrayCollection extends ArrayCollection
public override function dispatchEvent(event:Event):Boolean
if(event.type == CollectionEvent.COLLECTION_CHANGE)
// localIndex will be null when no sort or filter
localIndex = localIndex ?
localIndex.slice(0, 5) :