Thomas
Thomas

Reputation: 523

Apply a transparent circle to a flash movieclip

Is there a way to make part of a movieclip transparent? Using actionscript that is. I want to create 'holes' in a movieclip so I can see through it.

If needed I guess I can change the movieclip into a sprite if that makes it easier, but I am unfamiliar with flash so I need to learn the proper way to do such a thing.

My thanks in advance.

Upvotes: 1

Views: 877

Answers (3)

Myk
Myk

Reputation: 6215

This should do what you need, nothing too fancy required:

var s:Sprite = new Sprite(); // create a sprite to holder your image.
s.addChild(myImage); // add your image
addChild(s); // add your sprite to the stage.

var masker:Sprite = new Sprite(); // create a second sprite to be the mask
masker.graphics.beginFill(0x000000); // draw the shapes you want to use as masks
masker.graphics.drawCircle(50, 50, 100); // ...for instance, this circle
masker.graphics.endFill();
addChild(masker); // add your masker to the stage

s.mask = masker; // set the mask property of your image holder to be the masker

That should do what you need. Let me know if you have any further questions!

Upvotes: 0

divillysausages
divillysausages

Reputation: 8053

You can also check out BlendMode.ERASE on the blendMode option for a DisplayObject: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#blendMode

Upvotes: 3

www0z0k
www0z0k

Reputation: 4434

try using the mask property

Upvotes: 1

Related Questions