Hey, all these containers(TabNavigator, accordion etc) fire a change
event when the current tab changes.
I would add the following event handler for the creation complete event.
private function handleCreationComplete(): void
{
if(TabNavigator(this.parent).selectedChild == this)
{
handleTabChange();
}
else
{
TabNavigator(this.parent).addEventListener('change',
handleTabChange);
}
}
In the handleTabChange(), I would check if this is the first time this
child is visible by maintaining a class level variable and set it to
true the first time this function is called.
HTH.
- venkat
http://www.venkatj.com
--- In [email protected], "dave_defusion" <[EMAIL PROTECTED]>
wrote:
>
> I'm trying to add something into a panel in an accordion, I'm using
> the FlexEvent.SHOW to add the contents once the panel is displayed
> (this works pretty much everywhere else - e.g. a tab navigator). In my
> case trying to add the contents to a non visible element doesn't work
> (as I'm trying to get bitmap data), so I have to wait until they're
> visible before I can add my stuff.
>
> But in the Accordion it appears the FlexEvent.SHOW isn't fired the
> first time a panel is shown (the event listener added to the VBox that
> wraps panels content) -- it's fired the second time the panel is shown
> but never on the first time. I've tried listening for
> FlexEvent.INITIALIZE but that seems to be firing a little too early
> for what I'm doing.
>
> Basically all I need to know is as soon as a given panels content is
> displayed. I'd like a one solution fits all so for tab navigators etc.
> I only want to add my content when a non visible element becomes
> visible, but failing that I can add a specific workaround (if it's
> possible) to make it handle accordions different.
>
> Any ideas?
>
> Hope that makes sense.
>
> -D
>