topical media & game development
actionscript-lib-drawing-Rectangle.ax
actionscript-lib-drawing-Rectangle.ax
[swf]
flex
package {
// Represents a rectangle that can be drawn to the screen
public class @ax-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 @ax-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]);
}
}
}
(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.