Ok - This is still a bit more work then it should be, but seems to be the
least invasive method:
 Hook this.added and this.removed.
These events will fire once for each sub-component in your component, so you
need to use a state flag  and _only_ perform your setup/cleanup when the
state transitions.

But - on the plus side, it will fire each time your component is made
visible, and it doesnt require knowing anything about your parent, or what
type of container you embedded in, etc.

Thanks All,
Steve

On 11/16/06, Steve Hindle <[EMAIL PROTECTED]> wrote:


well - show event doesn't appear to fire unless I manually twiddle with
.visible

Using the parents change event means I can't just add my component to a
plain old canvas as Canvas doesn't fire change..
So my component needs to know more about how its being used then really
seems proper for a reusable component ?

Am I missing something here? Surely other people have run across the same
situation ?  Mostly I just want my component to reset its
tab navigator to the first tab each time its shown (I do other stuff
too).  It really can't be this unusual can it ?

Steve

On 11/16/06, Steve Hindle <[EMAIL PROTECTED]> wrote:
>
>
> Hi Matt,
>
>   Hmm - that might work, if I use the .parent field to find the
> components parent I could avoid hard coding parent names,etc...
> But it feels like it violates encapsulation - the component really
> shouldn't need to 'poke' its parent just
> to find out when its being used/viewed.
>
>  I'll also experiment more with show/hide - maybe I missed something in
> the docs...
>
> Thanks!
> Steve
>
> On 11/16/06, Matt Chotin <[EMAIL PROTECTED]> wrote:
> >
> >    Could you use the CHANGE event from the view stack instead?  Though
> > I would have expected the SHOW event to fire on the component anyway.
> >
> >
> >  ------------------------------
> >
> > *From:* [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED]
> > *On Behalf Of *Steve Hindle
> > *Sent:* Thursday, November 16, 2006 1:01 PM
> > *To:* flexcoders@yahoogroups.com
> > *Subject:* [flexcoders] Event fired _every_ time a component is made
> > visible/active
> >
> >
> >
> > Hi All,
> >
> > There was a discussion recently about how to detect when a component
> > becomes visible/active. It basically proposed 3 methods:
> > creationComplete(), show()/hide(), and UpdateDisplayList(). However,
> > these all seem to have problems:
> > creationComplete() - only fires when the component is created
> > show()/Hide() - not applicable if your using selectedChild
> > to switch views
> > UpdateDisplayList - Eek - gotta go to 'internals' to accomplish this
> > ?? scary...
> > Really seems like overkill for this
> > particular usage.
> >
> > Are there any other/simpliar methods for determining when a child is
> > made active/visible?
> >
> > For example, I'd like to re-initialize a component each time I switch
> > to it...
> > First time - no problem, creationComplete is called and my init runs.
> > However, if I switch to a different component using a menubar (and
> > selectedChild)
> > and then come back to the original component, how do I get my init
> > function called again?
> >
> > Steve
> >
> > > >
>
>

Reply via email to