Most of the UIComponent layout can be context bound. This is especially true for many of its derivatives (for example, HBox), since the fluidity of the layout is tied to it by the size of the parent and the number of brothers and sisters sharing the space of their parents.
In addition, Flex can be a real pain for visual updates. Often, critical rendering functions are not performed synchronously ... there are callLater , callLater2 and other hacker approaches that can cope with the callLater2 properties of the UIComponents layout of the main headache. Even calling validateNow or updateDisplayList can guarantee that the layout is in the current frame (instead of several frames in the future).
I suggest you use UIComponent best and try to use Sprite or something else.
Your approach, to attach it but make it invisible ( alpha = 0 , mouseEnabled = false , mouseChildren = false ), is worthy. You must listen to the FlexEvent.CREATION_COMPLETE callback before making sure it is laid out correctly. Then you can bitmapData.draw it, and then remove it from the scene. If you must use UIComponents, then I do not know a better way.
James fassett
source share