One way to do it is to create a new UIComponent and then call addChild
on it to add it to the display list:

        public function drawSomething():void {
                var circle:UIComponent = new UIComponent();
                var xPos:Number = 100;
                var yPos:Number = 100;
                var radius:Number = 50;
                circle.graphics.beginFill(0xFF8800);
                circle.graphics.drawCircle(xPos, yPos, radius);
                myPanel.addChild(circle);
        }

You can also create a new sprite and add it to the rawChildren list for
a container:

        public function drawSquare():void {
                var s:Sprite = new Sprite();
                myPanel.rawChildren.addChild(s);        
                var g:Graphics = s.graphics;
                g.clear();
                g.lineStyle(1,0x33CCFF,1.0);
                var fill:IFill = new SolidColor(0x9933CC,0.15);
                g.moveTo(x,y);
                fill.begin(g,new Rectangle(x,y,w,h));
                g.lineTo(w,x);
                g.lineTo(w,h);
                g.lineTo(y,h);
                g.lineTo(x,y);          
                fill.end(g);
        }

hth,

matt horn
flex docs 

> -----Original Message-----
> From: [email protected] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Chad Callahan
> Sent: Friday, September 08, 2006 11:52 AM
> To: [email protected]
> Subject: [flexcoders] drawing api
> 
> I need to make a custom class that draws shapes but I can't 
> seem to get the drawing api to work at all.  In AS2 it was 
> very simple, just using a beginFill and lineTo's and wala.  I 
> see there are a lot of "container" classes (Sprite, 
> DisplayObject, etc).  How do I go about say just drawing a 
> circle on my app?
> 
>  
> 
>  
> 
> 
> 
> CHAD CALLAHAN
> PROGRAMMER
> 
> T8DESIGN.COM | P 319.266.7574 - x195 | 877.T8IDEAS | F 888.290.4675
> 
> 
> This e-mail, including attachments, is covered by the 
> Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, 
> is confidential, and may be legally privileged. If you are 
> not the intended recipient, you are hereby notified that any 
> retention, dissemination, distribution, or copying of this 
> communication is strictly prohibited. Please reply to the 
> sender that you have received the message in error, and then 
> please delete it. Thank you.
> 
> ________________________________
> 
>  
> 
>  
> 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to