topical media & game development

talk show tell print

actionscript-lib-drawing-Ellipse.ax

actionscript-lib-drawing-Ellipse.ax [swf] flex


  package {
    // Represents an ellipse that can be drawn to the screen
    public class @ax-actionscript-lib-drawing-Ellipse extends actionscript_lib_drawing_BasicShape {
      // The width and height of the ellipse
      protected var w:Number;
      protected var h:Number;
      
      // Constructor
      public function @ax-actionscript-lib-drawing-Ellipse (width:Number = 100, height:Number = 100) {
        super();
        setSize(width, height);
      }
  
      // The ellipse drawing routine
      override protected function drawShape ():void { 
        graphics.drawEllipse(0, 0, w, h);
      }
      
      // Sets the width and height of the ellipse
      public function setSize (newWidth:Number, newHeight:Number):void {
        w = newWidth;
        h = newHeight;
  
        // Setting the width and height of the ellipse changes its shape, 
        // so it must be redrawn at the next render opportunity.
        setChanged();
      }  
    }
  }
  


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.