Posted By

adrianparr on 03/04/10


Tagged

dynamic mask graphics draw rectangle as3 rect Shape beginfill drawrect endfill


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


AS3 Draw a Simple Rectangular Mask


 / Published in: ActionScript 3
 

This is handy for quickly creating you own rectangular masks on-the-fly.

  1. import flash.display.Shape;
  2.  
  3. var rectMask:Shape = new Shape();
  4. rectMask.graphics.beginFill(0xFF0000, 1);
  5. rectMask.graphics.drawRect(0, 0, 320, 240);
  6. rectMask.graphics.endFill();
  7.  
  8. displayObjectToBeMasked.mask = rectMask;

Report this snippet  

You need to login to post a comment.