AS you might know, the only way to add Sprite based classes into a Flex project is by adding them to a UIComponent or a subclass of UIComponent. This adds some extra complications. One of these is that UIComponent does not report width and height correctly. If provided with an explicit width and height, the UIComponent’s size will be set to whatever it was when initialised and will not change if, for example, the contents of the component are scaled. This means that whatever contains the component will not respond appropriately. Dynamic sizing doesn’t seem to work at all. (As an aside, I do think that this is rather a poor implementation, since it breaks the existing functionality of DisplayObject)
In order to correctly set the size we need to recreate the DisplayObject functionality in order that from outside the component we can see the changes in size. In order to do that, it’s necessary to understand how UIComponent (and by extension, most of the other Flex components) is set up and handles sizing.
(more…)