1 Reply Latest reply on Oct 6, 2011 10:51 AM by chiedozi

    What is the difference between Show and ViewActivate in Flex 4.5

    rajaisgreat

      Hi,

       

      I was trying to find difference between show and viewactivate in Flex 4.5. My views are loaded very slowly, i have used show for most of the views.

       

      (mx.core.UIComponent.show        &           spark.components.View.viewActivate)

       

      Can we change to viewactivate? If yes, why? From perfomance perspective which one is faster?

       

      My mobile appliction is working fine but the performance is very slow (navigating between views).

       

      Can you suggest any links to help us improve performance? Your inputs will be really appereciated.

       

      Thank you,

      Raja

        • 1. Re: What is the difference between Show and ViewActivate in Flex 4.5
          chiedozi Level 1

          Hey Raja,

           

          The viewActivate event is dispatched after a view has been transitioned onto the screen.  So if you were to call pushView(), viewActivate would be dispatched on the incoming View after the animation completes.  If the initialization that you are doing doesn't need to occur until after the animation, then viewActivate is your best bet and can help with View initialization time.  UIComponent.SHOW isn't necessarily the best event to use for pre-transition initializations.  In those cases, I would recommend creationComplete or add.

           

          In terms of performance, the easiest way to improve view allocation performance is to reduce the complexity of the View.  This includes things like:

           

          - Flattening the display tree hierarchy.  For example, try to reduce the amount of nested groups on a page

          - Use actionScript skins for all your components

          - Defer intensive actionScript execution until after the transition (on viewActivate)

           

          I hope that helps, let me know if you have more questions.

          Chiedo