In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Re: How to draw a rectangle by calling graphics.drawCircle?

Question:
I could draw a Circle, by calling graphics.drawCircle
but how can I draw a Rectangle??
Answer:
Get Adobe Flash player
by makc3d 31 Mar 2009
// forked from mash's How to draw a rectangle?

// Question:
// I could draw a Circle, by calling graphics.drawCircle
// but how can I draw a Rectangle??
//
// Answer:
//
package {
    import flash.display.*;
    public class FlashTest extends Sprite {
        public var s:Sprite = new Sprite;
        public function FlashTest() {
            s.graphics.beginFill(0xFF0000);
            
            // draw a circle... or not?
            s.graphics.drawCircle( 0, 0, 8 * 0.005 );
            s.scaleX = 1600; s.scaleY = 800;
            s.x = 200; s.y = 150;
            addChild (s);
        }
    }
}

// credits to nitoyon,
// http://wonderfl.kayac.com/code/a7586dcf9187186a56d0aca148acb87bfe4ce80e