That should do it.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of dorkie dork from dorktown Sent: Wednesday, March 07, 2007 5:07 PM To: [email protected] Subject: Re: [flexcomponents]Event that tells me when parent is hidden or shown i think i got it. does this look right? import mx.core.Container; import mx.events.FlexEvent; private function init():void { Application.application.addEventListener (FlexEvent.HIDE,hideListener, true); } private function hideListener(event:Event):void { trace("container " + event.target.toString() + "is hidden"); var myContainer:Container = Container(event.target); if (myContainer.contains(DetailFrame)) { trace("my control is hidden!"); } } On 3/7/07, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: If there's a panel in a navigator that is going invisible, or a entire container of some sort, that's high enough and then you won't have extra traffic to wade through The contains() test is usually good enough to know that it affects you. -Alex Private function parentGoingInvisibleHandler(event:Event):void { If (Container(event.target).contains(me)) { Dowhatever(); } } ________________________________ From: [email protected] <mailto:[email protected]> [mailto:flexcompone [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of Peter Hall Sent: Wednesday, March 07, 2007 4:05 PM To: [email protected] <mailto:[email protected]> Subject: Re: [flexcomponents]Event that tells me when parent is hidden or shown To be sure, you need to listen to systemManger. Then check the target and see if it is an ancestor of your component. It's a bit messy still... Peter On 3/7/07, dorkie dork from dorktown <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: to which object would i add this so called "super" listener alex speaks of? On 07 Mar 2007 10:56:24 -0800, Gordon Smith < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: > adding event listeners does not add overhead does it? Not enough to worry about. But Alex's later reply had a better solution using the capture phase that doesn't require adding as many listeners. > when a parent container is hidden how does it hide the children When you set the 'visible' property of a DisplayObjectContainer to false, the Flash Player doesn't render that container or any of its descendants. - Gordon ________________________________ From: [email protected] <mailto:[email protected]> [mailto:flexcompone [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of dorkie dork from dorktown Sent: Tuesday, March 06, 2007 9:59 PM To: [email protected] <mailto:[email protected]> Subject: Re: [flexcomponents]Event that tells me when parent is hidden or shown ok. thanks gordon. so i just iterated up the chain adding event listeners i should be ok. adding event listeners does not add overhead does it? its the functions that get called that can add overhead right? one more additional question. when a parent container is hidden how does it hide the children? i thought it removed them through removeChild but no event is dispatched. in fact no hide, remove, removed or removeFromStage event is triggered when a parent container is hidden. On 06 Mar 2007 21:36:03 -0800, Gordon Smith < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: I think your component will have to listen to 'show' and 'hide' events from each of its ancestors. - Gordon ________________________________ From: [email protected] <mailto:[email protected]> [mailto:flexcompone [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of dorkie dork from dorktown Sent: Tuesday, March 06, 2007 8:00 PM To: [email protected] <mailto:[email protected]> Subject: [flexcomponents]Event that tells me when parent is hidden or shown I have a component that needs to know when a parent, grand parent, great grand parent etc, is hidden and when it is shown. The hide and show events never seem to be called on the children of a container that is hidden or shown.
