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>

 

Reply via email to