2 Replies Latest reply on Sep 9, 2008 7:35 PM by manofspirit

    Transitions on ViewStack?

    manofspirit Level 1
      Hi All,
      I have done transitions using STATES, but i dont know how to apply transitions on a ViewStack!
      Please guide me in this regard
      Thanks in Advance
        • 1. Re: Transitions on ViewStack?
          greg h_ Level 1
          Hi manofspirit,

          I am pretty sure that Flex transitions can only be used in association with Flex STATES. (Anyone, please correct me if I am incorrect on this ;-)

          However, Flex transitions are collections of effects. And effects can be applied to the view components within ViewStacks. This achieves, in many cases, much the same result as transitions with states.

          I have put up a demo example at the following link (with right-click "View Source" enabled):
          http://flexflashvideo.com/codesamples/flex/adobeforums/08/09/09/viewstack-transition/

          The example at the link above modifies the example for <mx:ViewStack> in the Flex 3 Language Reference here:
          http://livedocs.adobe.com/flex/3/langref/mx/containers/ViewStack.html#includeExamplesSumma ry

          The differences between the two are that my example creates two instances of <mx:Fade>, fadeOut and fadeIn. And these effects are then set on each of the view components that are children of the ViewStack, as follows:
          hideEffect="fadeOut" showEffect="fadeIn"

          Again, please go to the sample link above and right-click for "View Source" to see the code in context.

          Note: The fades are not being applied to the text in the examples above. To have Fade (and Rotate) effects work on text, the fonts used for that text must be embedded. For more detail on this, see the heading "Using embedded fonts with effects" at this doc link:
          http://livedocs.adobe.com/flex/3/html/behaviors_05.html

          You can also use composite effects using <mx:Parallel>and <mx:Sequence>.

          For a more complex example of applying effects on ViewStack children see the following example by Stephen Downs (a.k.a. Tink):

          PairedStackEffect (Fade & Squash)
          http://www.tink.ws/blog/pairedstackeffect-fade-squash/

          Note: The link above has a runnable example, and provides the code via a right-click "View Source"

          Please post back regarding whether the above answers your question, and if you find it helpful :-)

          Best regards,

          g
          • 2. Re: Transitions on ViewStack?
            manofspirit Level 1
            Thanks a lot Greg
            Your first code is pretty enough as a solution.
            Thanks once again