AS3 Draw a Simple Rectangular Mask


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.