Use graphics from Sprite to draw circle : Sprite « Development « Flex






Use graphics from Sprite to draw circle

Use graphics from Sprite to draw circle
         

<?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>

   
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Creates a new Sprite objectCreates a new Sprite object