Posted By

arpo on 10/12/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

StrawMan
sweetbabyyoung


Draw round rectangle where you can define each corner


 / Published in: ActionScript 3
 

Or check this out: Actionscript Drawing Classes http://www.mediaverk.lv/asd/

  1. function drawRoundRect(w ,h, tl, tr, bl, br, thick, borderColor, bgColor, trans) {
  2. var rect:Shape = new Shape();
  3. if (thick != 0) rect.graphics.lineStyle(thick, borderColor);
  4. rect.graphics.beginFill(bgColor, trans);
  5. rect.graphics.moveTo( 0, tl );
  6. rect.graphics.curveTo( 0, 0, tl, 0 );
  7. rect.graphics.lineTo(w - tr, 0);
  8. rect.graphics.curveTo( w, 0, w, tr );
  9. rect.graphics.lineTo(w, h - br);
  10. rect.graphics.curveTo( w, h, w - br, h );
  11. rect.graphics.lineTo(bl, h);
  12. rect.graphics.curveTo( 0, h, 0, h - bl );
  13. rect.graphics.endFill();
  14. return rect;
  15. }
  16.  
  17. var rv = drawRoundRect(200, 300, 5, 45, 0, 15, 0, 0x990099, 0xFF0000, 1);
  18. addChild(rv);

Report this snippet  

You need to login to post a comment.