Posted By

orazal on 08/29/07


Tagged

actionscript drawingAPI


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

n00ge


DrawingUtils


 / Published in: ActionScript
 

methods : drawRectangle

  1. class com.orazal.tools.DrawingUtils {
  2. /**
  3. * Uses flash's drawing api to draw a rectangle
  4. *
  5. * @param target The movieclip where the rectangle will be drawn
  6. * @param x The horizontal position from where to begin drawing
  7. * @param y The vertical position from where to begin drawing
  8. * @param w The rectangle width
  9. * @param h The rectangle height
  10. * @param fill The fill object
  11. * @param line The line object
  12. */
  13. public static function drawRectangle(target:MovieClip, x:Number, y:Number, w:Number, h:Number, fill:Object, line:Object):Void {
  14. with (target) {
  15. beginFill(fill.color, fill.alpha);
  16. if(line){
  17. lineStyle(line.width, line.color, line.alpha);
  18. }
  19. moveTo(x, y);
  20. lineTo(x+w, y);
  21. lineTo(x+w, y+h);
  22. lineTo(x, y+h);
  23. lineTo(x, y);
  24. endFill();
  25. }
  26. }
  27. }

Report this snippet  

You need to login to post a comment.