While adding a sprite to mxml base application it produces a error like :
cannot convert flash.display::Sprite@3d2a191 to mx.core.IUIComponent.
Sprite is nothing but a new object introduce which is similar to movieClip.
We can draw inside it and place it on to the stage by using its graphic object
The reason for error is mailny because sprite is the superclass of UIComponent , where as to add any object in mxml base container we need it to be a type of UIComponent. As the UIComponent class is the base class for all visual components. addChild method in UIcompoent Overrides the addChild method DisplayObjectContainer’saddChild method and adds a new object to mxml base container. (DisplayObjectContainer’ is a super class of sprite class )
Hence when we do addChild(newObject) we get a error , if newObject is of type sprite, as addChild which is invoked is of UIComponent class's method.
Hence we need to add a sprite to UIcompoent first and then the UIcomponent to mxml base container as follows :
<?xml:namespace prefix = mx /><mx:application initialize="drawStuff()" layout="absolute" mx="http://www.adobe.com/2006/mxml">