This content has been marked as final. Show 5 replies
If you give your VBox an id you can use something like this. I am making the assumption that your container is a Canvas but it could be anything.
Hm... might not be applicable when working with the TabNavigator....
Isn't there something like
// do something. continue looü
// stop loop
Otherwise it might be hard to use separate MXML fles for certain parts of the application...
You say TabNavigator but do you mean TabBar? I ask because the TabNavigator control Extends the ViewStack and implements the IFocusManager which has a method getFocus():IFocusManagerComponent.
I believe you could use this to identify which Object has Focus and then either fire off an event which your loop is waiting for or use the focusIn() event of the TabNavigator to trigger your loop. (There is also a focusOut() event)
If you are using the TabBar though that's a different matter. With a TabBar control I would suggest populating the TabBar with an ArrayCollection of Objects that contain some type of identifier you can use. You can then create a clickEvent method for the TabBar to do what ever you want which could easily include testing for a value in the ArrayCollection Object that tells you that your Loop should be Started/Stopped. If that value is part of the Event Targets Object then start the loop and if not then stop the loop.
Hope that helps.
But "focus"...? Doesn't this mean that I would actually have to click into the container e.g. by selecting something or clicking a button?
Is "seen by the user" the same as "having focus"?
i guess not....
Use a while loop to see if the parent's visible property if it is true. If you find a parent with visible=false, you know you're not visible