package { // Represents a rectangle that can be drawn to the screen public class actionscript_lib_drawing_Rectangle extends actionscript_lib_drawing_Polygon { // The width and height of the rectangle protected var w:Number; protected var h:Number; // Constructor public function actionscript_lib_drawing_Rectangle (width:Number = 100, height:Number = 100) { super(); setSize(width, height); } // Sets the width and height of the rectangle public function setSize (newWidth:Number, newHeight:Number):void { w = newWidth; h = newHeight; // Translate the width and height into points on the polygon setPoints([0,w,w,0],[0,0,h,h]); } } }