How can I add effects to the show/hide of a spark control? [duplicate]
开发者_如何转开发Possible Duplicate:
Flex 4 Group showEffect/hideEffect
I have an existing flex application that uses databinding to show/hide certain elements. It looks a little like this:
<namespace:CustomComponent visible="{modelObject.showCustomComponent}" />
To spruce it up a little bit, I went in and did this:
<s:Move id="ccRollIn" target="{cc}" xFrom="-400" xTo="50" />
...
<namespace:CustomComponent id="cc" visible="{modelObject.showCustomComponent}" show="ccRollIn.play()" hide="ccRollIn.play(null, true)" />
The problem with this is that while the show event plays perfectly, the item disappears from view before the hide effect has a chance to play. Is there a simple way to handle adding animations to this workflow?
Use showEffect
and hideEffect
as in documentation or in this sample.
Change the component line to
<ns:Component showEffect="{move1}" hideEffect="{move2}" />
and in the Declarations, add this:
<s:Move id="move1" xFrom="-400" xTo="50" />
<s:Move id="move2" xTo="-400" xFrom="50" />
精彩评论