Posted By

ricosushi on 07/14/10


Tagged

draw rectangle as3


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ricosushi


Draw rectangle


 / Published in: ActionScript
 

Params: Color, alpha, x pos, y pos, width, height

  1. // Draws a solid rectangle inside a movieClip
  2. function drawRectangle(target:MovieClip,
  3. color:Number,
  4. alpha:Number,
  5. x:Number,
  6. y:Number,
  7. w:Number,
  8. h:Number
  9. ):Void{
  10.  
  11. target.beginFill(color, alpha);
  12. target.moveTo(x, y);
  13. target.lineTo(w, y);
  14. target.lineTo(w, h);
  15. target.lineTo(x, h);
  16. target.lineTo(x, y);
  17. target.endFill();
  18. }// draw rectangle
  19.  
  20.  
  21. // USAGE ---------------------------------------------------------//
  22. drawRectangle(movieClip_MC, 0xFF0FFF, 0, 0, 100, 100, 100);

Report this snippet  

You need to login to post a comment.