1 Reply Latest reply on Sep 15, 2012 5:38 AM by cdsvvxv

    SOLVED: TabNavigator changed event

    cdsvvxv

      ----- THIS HAS NOW BEEN SOLVED ----- (solution is below)

       

      I have a TabNavigtor that has NavigatorContent Objects created in actionscript. The MyNavigatorContent contains a MyObject1 which in turn contains a MyObject2 component.

       

      MyTabNavigtor

          |

          | ----- MyNavigatorContent

                               |

                               | ----- MyObject1

                                                  |

                                                  | ----- MyObject2  (This is slow to create)

       

      The MyObject2 is quite slow to instantiate and so I have added a change handler to the MyTabNavigator. When the change handler is called I get the MyObject1 from the MyNavigatorContent and tell it to instantiate the MyObject2, which all works correctly. My problem is that the instantiation of MyObject2 occurs before the tab is actually changed. Therefore the user clicks on the tab, and has to wait for the MyObject2 to be created before they see the effect of their mouse click. I would like to fire the creation of MyObject2 later on, essentially in a TabNavigator changed event rather than a TabNavigator change event, but there isn't one.

       

      Another things I would like to do is display a ProgressBar after the user clicks on tab to let them know that something is happening. However this doesn't seem possible either as any dialog I show appears after the tab has changed and therefore MyObject2 is already created.

       

      Is there a way around either of these problems?

        • 1. Re: SOLVED: TabNavigator changed event
          cdsvvxv Level 1

          The solution was a standard technique I didn't know about. I created a Timer event to break down the workload of MyObject2 so that in between the timer calls the Flex framework could continue processing while the MyObject2 stack was asleep. This fixed both the slow tab change problem and also allows me to display a progress bar.