0
votes

I'm working in FlashBuilder 4.6 on a Flex app. I want to know if there's a function that is called when a component (in my case a tab on a tabbed dialog mx:TabNavigator) becomes visible to the user? I tried creationComplete and that is called for the 2nd and 3rd tabs in my dialog when the user clicks on them, but it's called for the first tab when the whole application opens, i.e. before the first tab is visible.

Thank you, Fred

4

4 Answers

2
votes

InitializationComplete() is the function that is called when the children of a tab (Container) have been fully initialized. I usually override this function in the Container that is a child of the ViewStack class/subclass in order to do set up on first show. You can also listen for the show event to run code on subsequent shows. For some reason, the Flex team decided that the first time a component shows, it's not a show.

However, your problem is likely related to not fully utilizing the component life cycle. What's the full context?

1
votes

Not knowing which specific container you're using but all of them have some variant of the kind of event: IndexChangedEvent.CHILD_INDEX_CHANGE

This is triggered on a halo:Container which is the base for a TabNav, ViewStack, etc. The spark / air equivalents should have something similar.

0
votes

Every UIComponent has Show Event, so you can listen for it in order to know when specific content in ViewStack becomes visible.

0
votes

You can add an eventListener for its creationcomplete or click event along with its index and write specific actions to it. Code can be provided on request.