/** * com.jR.Drawing.Rectangle * March 14th, 2006 * Copyright (c) Jānis Radiņš ( janis@mediaverk.lv ) * * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class com.jR.Drawing.Rectangle extends com.jR.Drawing.Polygon { private var _width:Number = null; private var _height:Number = null; private var _radius:Number = null; private var _radius1:Number = 0; private var _radius2:Number = 0; private var _radius3:Number = 0; private var _radius4:Number = 0; public function Rectangle(host:MovieClip, level:Number) { super(host, level); addPoint(0, 0, 0); addPoint(0, 0, 0); addPoint(0, 0, 0); addPoint(0, 0, 0); _roundCorners = true; } public function set width(value:Number):Void { _width = value; } public function set height(value:Number):Void { _height = value; } public function set radius(value:Number):Void { _radius1 = _radius2 = _radius3 = _radius4 = value; } public function set radius1(value:Number):Void { _radius1 = value; } public function set radius2(value:Number):Void { _radius2 = value; } public function set radius3(value:Number):Void { _radius3 = value; } public function set radius4(value:Number):Void { _radius4 = value; } public function get width():Number { return _width; } public function get height():Number { return _height; } public function get radius():Number { if ((_radius1+_radius2+_radius3+_radius4)/4 == _radius1) { return _radius1; } return null; } public function get radius1():Number { return _radius1; } public function get radius2():Number { return _radius2; } public function get radius3():Number { return _radius3; } public function get radius4():Number { return _radius4; } private function dealArguments(__inputObject:Object):Void { if (_autoClear == true) { clear(); } for (var i in __inputObject) { if (this["_"+i] !== undefined && this[i] !== undefined) { this[i] = __inputObject[i]; } } if(_width == null || _width == 0 || _height == null || _height == 0){ throwError("Not enough data to draw rectangle", false); return; } modifyPoint(0, {x:0, y:0, r:radius1}); modifyPoint(1, {x:_width, y:0, r:radius2}); modifyPoint(2, {x:_width, y:_height, r:radius3}); modifyPoint(3, {x:0, y:_height, r:radius4}); } }