Creating opacity gradient mask in Flash 8
26.01.08Posted by: Jayhan Sim
I’m a flash user since version MX, it is a very great tool to create interactive web contents. But there is one effect I want to achieve but couldn’t do in Flash: creating opacity mask. But thing had changed. Opacity mask can be done in Flash since version 8! Hopefully I am not too late to know this. Here I am going to tell you how to create opacity gradient mask with just few lines of codes in Flash.
To do this tutorial, you need Macromedia Flash 8 of course and a picture to mask. Before proceed, you can try to feel the opacity mask effect by dragging the masked image in the flash above, and starts the tutorial.
First, launch the Flash 8 program and create a new flash document. Then, import any picture you like to use and convert it to a movie clip symbol by pressing F8. Then giving this movie clip an instance name call “picture”. Now you can lock the layer and create a new layer on top.
Next, you need to create a opacity gradient mask to mask the picture. Select the Oval Tool and draw out a circle on top of the picture. Delete the stroke if exist and make the Solid Color Fill to Radial Gradient. Now you have to make an end point of the gradient transparent by dragging the Alpha level from 100% to 0%. The circle gradient now is from color and faded to transparent. Select this circle and convert it to movie clip and giving this the instance name “mask”.
Create another layer, and on the first frame, enter the code below:
// to set the mask
picture.setMask(mask);// to make the opacity gradient mask draggable
mask.onPress = function() {
startDrag(“mask”);
};
mask.onRelease = function() {
stopDrag();
};
Now here is the magical part. To make the opacity mask works, you need to tick Use runtime bitmap caching for “picture” and “mask” instances shown below. It is just located at the bottom of Blend option.

After ticking for both instances, save this flash document and Ctrl+Enter to test this movie. Now you should have your opacity gradient mask working by just using simple Action Script! Hope this tutorial helps and here I upload my source file to download for your reference.

Download tutorial file (21KB)




Yo! wah is damn cool this tutorial, i love it men, thank for sharing this tutorial! Keep it up men!
January 26th, 2008 at 11:12 pmGlad that you like it, Kean Hui
January 28th, 2008 at 11:27 pmGreat job and thanks for sharing it!
February 8th, 2008 at 4:48 amvery useful
April 10th, 2008 at 5:20 pmThank you very much
April 11th, 2008 at 9:52 amCool… I’ve been looking for this from so long
Great !
April 18th, 2008 at 1:09 pmGlad that you found it
April 22nd, 2008 at 11:21 pmIt does not work, can you help me in this regards, I am using Flash MX
April 30th, 2008 at 6:01 pmhi SABER, Flash MX does not support this feature, you need at least Flash 8
May 1st, 2008 at 1:11 pmgreat….thank you
July 30th, 2008 at 7:30 amГммм…не понял ход мысли.
August 4th, 2008 at 11:08 pmthankyou for sharing, I’ve been frustrated with the same issue and have been forced to import .pngs from Fireworks to achieve the affect – this is great!
August 30th, 2008 at 2:20 amПодскажите, как бороться с этим С П А М О М?
February 20th, 2009 at 2:29 pm[...] View Tutorial No Comment var addthis_pub=”izwan00″; BOOKMARK This entry was posted on Thursday, July 2nd, 2009 at 4:14 pm and is filed under Adobe Flash Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. [...]
July 2nd, 2009 at 6:44 pmThanks man, flash can sometimes be a pain in the ass but you just made my cure
December 4th, 2009 at 5:04 pmI am new to blogging and getting information out there. Your post here is watch very informative and gives me more insight as to creating an watch impact when commenting.
February 25th, 2010 at 1:40 amReally cool tut man. Stay tuned!!!
June 25th, 2010 at 4:11 pmSuper post – and great domain by the way:-)
July 11th, 2010 at 3:19 pmgreat….thank you
September 23rd, 2010 at 2:12 amVery interesting information, thanks for article!
September 26th, 2010 at 5:39 pmI love that this post is nearly 3 years old and still so helpful! I tried 3 other methods tutorial-ed elsewhere to achieve the same effect but yours was the only one that worked properly. So, thanks!
It’s disappointing Flash doesn’t support gradient masks w/o actionscript. Oh well…
November 12th, 2010 at 12:14 amGlad that it helps!
November 14th, 2010 at 4:33 am