Thanks for that. Is there anyway to prevent the display list from updating until after the effect has finished playing? With the code as it stands now, while the fade is playing you see 2 oranges and 2 lemons. I'd like the apple and grape to fade out, and then the orange and lemon to get shifted up.
btw, I actually have this working without filtering the data provider and just manually fading/rearranging similar to the Flex Store example, but I think that filtering the data provider would be much cleaner if I can make it work. Jesse --- In [email protected], "Joan Lafferty" <[EMAIL PROTECTED]> wrote: > > Use the removedEffect rather than hideEffect. This works as long as the > Repeater is not the last item in your Application. For some reason, when > it is the last item, I get a runtime error. I'll file a bug for this. > > > > Try this: > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " layout="vertical" > creationComplete="creationComplete()"> > <mx:Script> > <![CDATA[ > import mx.collections.ArrayCollection; > > [Bindable] > private var fruits:ArrayCollection = new ArrayCollection > (["Apple","Orange","Lemon","Grape"]); > > private function isCitrus(item:String):Boolean > { > return (item == "Orange" || item == "Lemon"); > } > > private function creationComplete():void > { > fruits.filterFunction = isCitrus; > } > ]]> > </mx:Script> > <mx:Button click="fruits.refresh()" label="Show Citrus"/> > <mx:Repeater id="fruitCBs" dataProvider="{fruits}"> > <mx:CheckBox label="{fruitCBs.currentItem}" removed="{fadeOut}"/> > </mx:Repeater> > <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/> > > <mx:Spacer id="blank" /> > </mx:Application> > > > > > > Joan > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of jesse_bigfix > Sent: Thursday, February 21, 2008 10:17 AM > To: [email protected] > Subject: [flexcoders] how to play an effect on data provider filter? > > > > Is it possible to play an effect when the data provider feeding a > UIComponent is filtered using a filter function? For example in the > following code, > when the non-citrus checkboxes are removed, I'd like them to play the > fadeOut effect but instead they are just removed immediately. > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " layout="vertical" > creationComplete="creationComplete()"> > <mx:Script> > <![CDATA[ > import mx.collections.ArrayCollection; > > [Bindable] > private var fruits:ArrayCollection = new ArrayCollection > (["Apple","Orange","Lemon","Grape"]); > > private function isCitrus(item:String):Boolean > { > return (item == "Orange" || item == "Lemon"); > } > > private function creationComplete():void > { > fruits.filterFunction = isCitrus; > } > ]]> > </mx:Script> > <mx:Button click="fruits.refresh()" label="Show Citrus"/> > <mx:Repeater id="fruitCBs" dataProvider="{fruits}"> > <mx:CheckBox label="{fruitCBs.currentItem}" hideEffect="{fadeOut}"/> > </mx:Repeater> > <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/> > </mx:Application> >

