views:

297

answers:

2

Is there a way to tell at runtime if a flex UIComponent is in the user's view or not. For example, if I have a tabNavigator with a combobox on each tab, is there a property of the comboBox that will tell me if it is visible to the user or not when I switch from one tab to another? I know it is not the comboBox.visible property. That is set to "true" for both comboboxes. I want a property that will change when I switch from one tab to another making the comboBox visible to the user. I don't know what that property is.

A: 

I am a bit confused about the question. Do you want to know if the combobox visible property is true or if the user can actually see it (which would be false if the user had scrolled away from the combobox and it was not currently on the screen although the visible property is true). For the most control over the visibility of the comboboxes I would bind the visible property to a global variable. You can then change these to be whatever you want when the user clicks a tab.

Jeff Pinkston
A: 

What you actually need to do to determine if a UIComponent / DisplayObject truly visible is to check the "visible" property for that object AND the visible property of all its parents. Please see my answer to a related question here (includes code):

http://stackoverflow.com/questions/452344/flex-determine-if-a-component-is-showing/452450#452450

cliff.meyers