Mega Code Archive

 
Categories / Flex / Container
 

Add Sprite object as a child of UIComponent before adding it to Panel

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:Script>     import flash.display.Sprite;     import mx.core.UIComponent;          private function addChildToPanel():void {         var circle:Sprite = new Sprite();         circle.graphics.beginFill(0xFFFF00);         circle.graphics.drawCircle(0, 20, 20);         var c:UIComponent = new UIComponent();         c.addChild(circle);         panel1.addChild(c);     }   </mx:Script>     <mx:Panel id="panel1" height="100" width="100" />     <mx:Button id="myButton" label="Click Me" click="addChildToPanel();" /> </mx:Application>