Flex How to delay setStyle until next update?
I have a component with two parts, say two Hboxes A and B in a Vbox.
For a specific call, I want:
- Hide B with B.visible = false
- setStyle("borderSkin", FooBorderOn);
The problem is that the border is drawn before the parent Vbox is resized, so I end up with a border around the Vbox with B invisible:
..................... . A . . . . . . . . BLANK SPACE . .....................
I need a border for et around the next updated vbox size. Is there something like "do to afer redraw"? in flex?
Thank you very much
a source to share
There are several ways to postpone action. If you are developing a UI component yourself, take a look at invalidateProperties / commitProperties. It's a mechanism that doesn't get stuck in update loops: you mark the property to be updated (usually by storing it in temp var and / or adding an xxxChanged Boolean) and call invalidateProperties (). Flex will then call commitProperties () a little later - after copying a few changes that might affect each other - where you can make your actual change.
callLater would also be an option, although usually not as "later" as one might think :) (This is the next screen refresh, which could happen pretty soon, even before other events in the queue)
However, in your case, from your description, I think you just missed the includeInLayout property. The containers will decide to display (visible) or free up space (includeInLayout) for objects based on these two separate properties. See also Preventing the layout of hidden controls .
a source to share