I am working on my project and need to create thermometer component in flash (component will display current temp value). So I decided to use Sprite (flash.display.Sprite) component as wrapper and created these children:
- flash.display.Bitmap, BitmapData - background, thermometer image
- flash.text.TextField - text (current value of temperature with unit)
- flash.display.Shape - thermometer bar
Next I need to add some blinking text (Missing value) and the best would be to use mx.contols.Label (or spark Label) component (support of AnimateColor). But when I add new Label component to the wrapper, added label is not displayed. So I would like to know if it is possible to add mx.controls.* components to Sprite or what solution is recommended.
mx components must be used in the context of the Flex Framework. If you add a Flex component to a non-Flex container--such as a Sprite--then you are using the component outside of the Flex context and the Flex Framework classes--such as LayoutManager--will not know to call methods such as measure(), createChildren(), updateDisplayList(), or commitProperties().
IF this is what you're trying to do; then the reason nothing shows up is because the component did not go through it's Flex Component LifeCycle; thus creating nothing to display.
If you're building something in Flash Pro, or with an ActionScript only project in Flash Builder, then you probably aren't using the Flex Framework and I would not expect the component to work. However, if that were the case I would expect you'd see compile errors due to missing dependencies.