Flash AS3 Set Mask Dynamically

You can set a mask in AS3 using the following actionscript.

function init(){
container_mc.mask = mask_mc;
}
init();

If you have an alpha gradient mask, you will have to use cacheAsBitmap:

function init(){
container_mc.cacheAsBitmap = true;
mask_mc.cacheAsBitmap = true;
container_mc.mask = mask_mc;
}
init();

You may also like...

2 Responses

  1. Alexander says:

    Flash Actionscript 2.0 Mask
    As a reminder for those of us still having to use AS2 for banner development you use the following code to set the bitmap mask:

    maskMC.cacheAsBitmap = true;
    artMC.cacheAsBitmap = true;
    artMC.setMask(maskMC);

  1. December 11, 2012

    … [Trackback]…

    […] There you will find 25846 more Infos: newsourcemedia.com/blog/flash-as3-set-mask-dynamically/ […]…

Leave a Reply