/ Published in: ActionScript
methods : drawRectangle
Expand |
Embed | Plain Text
class com.orazal.tools.DrawingUtils { /** * Uses flash's drawing api to draw a rectangle * * @param target The movieclip where the rectangle will be drawn * @param x The horizontal position from where to begin drawing * @param y The vertical position from where to begin drawing * @param w The rectangle width * @param h The rectangle height * @param fill The fill object * @param line The line object */ public static function drawRectangle(target:MovieClip, x:Number, y:Number, w:Number, h:Number, fill:Object, line:Object):Void { with (target) { beginFill(fill.color, fill.alpha); if(line){ lineStyle(line.width, line.color, line.alpha); } moveTo(x, y); lineTo(x+w, y); lineTo(x+w, y+h); lineTo(x, y+h); lineTo(x, y); endFill(); } } }
You need to login to post a comment.
