Return to Snippet

Revision: 24578
at March 4, 2010 09:17 by adrianparr


Updated Code
import flash.display.Shape;

var rectMask:Shape = new Shape();
rectMask.graphics.beginFill(0xFF0000, 1);
rectMask.graphics.drawRect(0, 0, 320, 240);
rectMask.graphics.endFill();

displayObjectToBeMasked.mask = rectMask;

Revision: 24577
at March 4, 2010 09:05 by adrianparr


Initial Code
import flash.display.Shape;

var rectMask:Shape = new Shape();
rectMask.graphics.beginFill(0xFF0000, 1);
rectMask.graphics.drawRect(0, 0, 320, 240);
rectMask.graphics.endFill();
addChild(rectMask);

displayObjectToBeMasked.mask = rectMask;

Initial URL

                                

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

Initial Title
AS3 Draw a Simple Rectangular Mask

Initial Tags

                                

Initial Language
ActionScript 3