I did say ugly :P

If you can rely on calling a method to check for visibility something
like this in your custom component should work I'd think:

public function isReallyVisible():Boolean {
        var isVisible:Boolean = visible;
        var parent:UIComponent = this.parent;
                        
        while(parent != null && isVisible) {
                isVisible = parent.visible;
                parent = parent.parent;
        }
                        
        return isVisible;
}

FYI I haven't run that code at all.

Doug

On Sat, Apr 12, 2008 at 8:18 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
>
>
> I was about to say that #1 and #2 could have serious performance
> implications.  Visibility is changed at least once per UIComponent (they are
> invisible when created).
>
>
>
>  ________________________________
>
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Doug McCune
>  Sent: Saturday, April 12, 2008 8:00 PM
>  To: [email protected]
>  Subject: Re: [flexcoders] how do I know when a component is invisible
>
>
>
>
>
>
>
>
> "or if its parent's parent is not the current view in a viewstack"
>
>  I think when the selected child changes in a ViewStack the ViewStack
>  sets the visible property of the old child to false, so checking
>  visibility of parents would still work in that case (same with TabNav
>  or Accordion).
>
>  Doug
>
>  On Sat, Apr 12, 2008 at 7:52 PM, Doug McCune <[EMAIL PROTECTED]> wrote:
>  > Ugly way #1:
>  > Try adding a listener to SystemManager for the FlexEvent.SHOW and
>  > FlexEvent.HIDE event using the capture phase. Then when that comes in
>  > loop over all the children of the component that is being shown and do
>  > whatever it is you need to do when you find a certain component is
>  > being shown or hidden
>  >
>  > Ugly way #2:
>  > monkey patch UIComponent. Change the getter for visible. If the
>  > UIComponent has normal visibility set to true, then check if it has a
>  > parent, if so return the parent's visibility (and since you're monkey
>  > patching UIComponent that would trickle all the way up the display
>  > list)
>  >
>  > What is it exactly that you need to do if somewhere up in the display
>  > list a parent has visible set to false?
>  >
>  > Doug
>  >
>  >
>  >
>  > On Sat, Apr 12, 2008 at 7:35 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > There's no quick answer, you have to test each parent.
>  > >
>  > >
>  > >
>  > > ________________________________
>  > >
>  > >
>  > > From: [email protected] [mailto:[EMAIL PROTECTED] On
>  > > Behalf Of Jason Rayles
>  > > Sent: Saturday, April 12, 2008 10:56 AM
>  > > To: [email protected]
>  > > Subject: [flexcoders] how do I know when a component is invisible
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > I have some custom components, and they live inside various containers
>  > > inside various containers.
>  > >
>  > > How can I let my components know that they are invisible, whether it is
>  > > the component itself that has visible=false or the parent's visibility
>  > > is false or if its parent's parent is not the current view in a
>  > > viewstack or any other permutation?
>  > >
>  > > Thanks,
>  > > Jason
>  > >
>  > >
>  >
>
>  

Reply via email to