Sorry - took me a while to get around to building a small example app.
 But thanks for the LCV solution - works like I expected the
ArrayCollection filter to work.

So, this will filter the list after it gets to 5 items and then once
it's filtered, the addItemAt calls no longer work.

Thanks - 
cris.

----

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" initialize="initApp()">
    <mx:Script>
        <![CDATA[
            import mx.collections.*;

            [Bindable]
            public var ac:ArrayCollection;
            
            private var count:Number;
            
            private var timer:Timer;
            
            public function initApp()
            {
                    ac = new ArrayCollection();
                    count = 0;
                    
                    update();
                    
                    timer = new Timer(1000, 0);
                    timer.addEventListener("timer", update);
                timer.start();
            }
            
            public function update(event:TimerEvent = null)
            {
                ac.addItemAt(count, count++);
                
                if (count == 5)
                {
                        ac.filterFunction = onlyEvens;
                        ac.refresh();
                }
                else if (count == 10)
                {
                        ac.filterFunction = null;
                        ac.refresh();
                }
            }
            
                public function onlyEvens(item:Object):Boolean
                        {
                                return (Number(item) % 2 == 0);
                        }

            ]]>
    </mx:Script>

        <mx:List x="10" y="10" width="161" height="359"
dataProvider="{ac}"></mx:List>
        
</mx:Application>



Reply via email to