Flex 4: can transitions be used with includeIn and excludeFrom attributes?
Can transitions be added to a source code that uses includeIn
and excludeFrom
to show/hide elements? It seems that elements are hidden immediately not allowing enough time for the transition to be played.
In t开发者_运维问答his documentation article, a method with visible
and includeInLayout
properties is used but that would mean I would need to rewrite my MXML code which I'd rather avoid.
Yes, Flex 4 transitions work well with states. I think you need to look closer at the AddAction and RemoveAction tags. There is a nice introduction video made by Chet Haase, called "Flex 4 States And Transitions". Try google it
Yes, that is precisely a use case for transitions (hiding/showing elements nicely with states).
Take the following example:
<s:Transition fromState="stateA" toState="stateB" autoReverse="true">
<s:Sequence>
<s:Fade targets="{[componentA]}"/>
<s:Resize targets="{[componentB]}"/>
</s:Sequence>
</s:Transition>
<s:Transition fromState="stateB" toState="stateA" autoReverse="true">
<s:Sequence>
<s:Resize targets="{[componentB]}"/>
<s:AddAction target="{componentA}"/>
<s:Fade targets="{[componentB]}"/>
</s:Sequence>
</s:Transition>
The example above, componentA is only shown in stateB while componentB is resized to accommodate it. When transitioning from stateA to stateB (i.e. componentA is going away), componentA is faded out first and then the outer container is resized. When transitioning from stateB to stateA (i.e. adding componentA within componentB), componentB is first resized, then componentA is added with a fade-in effect (note the need to specify the exact point within the sequence when componentA is actually added).
精彩评论