Flash inverted mask

故事扮演 提交于 2019-12-19 08:56:15

问题


I've been looking for a simple way to invert a mask in flash. Its just amazing how it doesn't have this feature.

I just really need to paint shape and whatever is below (in layers) wont show up.

Any suggestions?


回答1:


To create an inverted mask in code do the following

private function createInvertedMask(mcToBeMasked:MovieClip):void {

        mcToBeMasked.blendMode = BlendMode.LAYER;
        var invertedMask:Sprite = new Sprite();
        invertedMask.graphics.beginFill(0x0, 1);
        invertedMask.graphics.drawRect(640, 395, 630, 395);
        invertedMask.blendMode = BlendMode.ERASE;
        mcToBeMasked.addChild(invertedMask);
    }

To create an inverted mask in the Flash Professional IDE Choose the properties panel of the image you want masked, select "Display" -> "Blending" -> "Layer" Then select your mask, and choose "Display -> "Blending" -> "Erase" You'll see something like this:




回答2:


NOTE: Remember for this to work inside a movie clip (i.e. you have created an inverted animated mask movie clip that will erase itself etc); the movie clip in which it is embedded MUST BE SET TO BLENDMODE: LAYER ALSO otherwise the overall effect will be ignored - hope this helps!



来源:https://stackoverflow.com/questions/2231587/flash-inverted-mask

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!