EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 377

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Using movie clips as masks 377
6. In the Actions panel, enter the following code:
System.security.allowDomain("http://www.helpexamples.com");
this.createEmptyMovieClip("img_mc", 10);
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip):Void {
target_mc.setMask(mask_mc);
}
var my_mcl:MovieClipLoader = new MovieClipLoader();
my_mcl.addListener(mclListener);
my_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",
img_mc);
7.
Select Control > Test Movie to test the document.
An external JPEG image loads into the SWF file at runtime, and is masked by the shape
you drew previously on the Stage.
For detailed information, see setMask (
MovieClip.setMask method) in the
ActionScript 2.0 Language Reference.
About masking device fonts
You can use a movie clip to mask text that is set in a device font. In order for a movie clip
mask on a device font to work properly, the user must have Flash Player 6 (6.0.40.0) or later.
When you use a movie clip to mask text set in a device font, the rectangular bounding box of
the mask is used as the masking shape. That is, if you create a nonrectangular movie clip mask
for device font text in the Flash authoring environment, the mask that appears in the SWF file
is the shape of the rectangular bounding box of the mask, not the shape of the mask itself.
You can mask device fonts only by using a movie clip as a mask. You cannot mask device fonts
by using a mask layer on the Stage.
About alpha channel masking
Alpha channel masking is supported if both the mask and the maskee movie clips use bitmap
caching. This support also lets you use a filter on the mask independently of the filter that is
applied to the maskee itself.
To see an example of alpha masking, download the alpha masking sample file from
www.macromedia.com/go/flash_samples.
In this sample file, the mask is an oval (
oval_mask) that has alpha of 50% and a blur filter
applied to it. The maskee (
flower_maskee) has alpha of 100% and no filter applied on it.
Both movie clips have runtime bitmap caching applied in the Property inspector.

Table of Contents

Related product manuals