In Flash, you put a mask on one layer and the content that is masked in a layer below it.. A single layer called content contains a movie clip of the second section about a new car.. 2 I
Trang 1In this function, which is executed when the user clicks the Loader object, the
Loader object is removed from the Stage, and then the playhead of each movie
clip on the Stage moves to the first frame and begins playing
3 Choose Control > Test Movie > in Flash Professional to preview the movie
Click on any of the four sections, and then click on the loaded content to return
to the main movie
When you return to the main movie, all four movie clips play their nested
animations
Creating Masks
Masking is a way of selectively hiding and displaying content on a layer Masking is
a way for you to control the content that your audience sees For example, you can
make a circular mask and allow your audience to only see through the circular area,
so that you get a keyhole or spotlight effect In Flash, you put a mask on one layer
and the content that is masked in a layer below it
Masks can be animated, and the content that is masked can also be animated So,
the circular mask can grow bigger to show more content, or the content can scroll
under a mask like scenery whizzing by a train window
define the Mask and Masked layers
You’ll create a rectangular mask that starts small and grows larger to cover the
Trang 21 Open the file page2.fla
A single layer called content contains a movie clip of the second section about
a new car
2 Insert a new layer above the content layer and rename it mask.
3 Double-click the icon in front of the layer name
The Layer Properties dialog box appears
4 Select Mask and click OK
Trang 3The top layer becomes a Mask layer Anything that is drawn in this layer will act
as a mask for a Masked layer below it
5 Double-click the icon in front of the bottom layer named content
The Layer Properties dialog box appears
6 Select Masked and click OK
The bottom layer becomes a Masked layer and is indented, indicating that it is
affected by the mask above it
Create the mask
The mask can be any filled shape The color of the fill doesn’t matter What’s
impor-tant to Flash is the size, location, and contours of the shape The shape will be the
“peephole” through which you’ll see the content on the layer below You can use
any of the drawing tools to create your mask
1 Select the Rectangle tool
Note: You can also
simply drag a normal layer under a Mask layer, and Flash will convert it
to a Masked layer.
Trang 43 Select the top Mask layer and draw a thin rectangle just off to the left of the Stage Make the height of the rectangle slightly larger than the Stage
4 Right-click/Ctrl-click the rectangle and select Create Motion Tween
5 Flash asks to convert the rectangular shape to a symbol so you can apply a motion tween Click OK
The top layer becomes a Tween layer, and one second’s worth of frames is added to the Timeline
Trang 56 Insert the same number of frames in the bottom layer
7 Move the playhead to the last frame, frame 24
8 Select the Free Transform tool
9 Click on the rectangular symbol
The free transform handles appear around the rectangular symbol
10 Hold down the Alt/Option key and drag the right edge of the free transform
handle to expand the rectangle to cover the entire Stage
The rectangle becomes wider at the last frame The motion tween creates a
smooth animation of the rectangle growing wider and covering the Stage
Trang 611 To see the effects of the Mask layer on its Masked layer, lock both layers Scrub the red playhead back and forth along the Timeline to see how the motion tween uncovers the content in the bottom layer
12 Insert a new layer and rename it actionscript.
13 Insert a keyframe at frame 24 of the actionscript layer and open the Actions panel
14 In the Script pane of the Actions panel, enter stop();
15 Choose Control > Test Movie > in Flash Professional
As the motion tween proceeds in the Mask layer, more of the Masked layer
is revealed, creating a cinematic transition known as a wipe If you open
Note: Flash does
not recognize different
Alpha levels of a mask
For example, a mask
drawn with a fill at
an Alpha value of
50% will still mask at
100% However, with
ActionScript you can
dynamically create
masks that will allow
transparencies Masks
also do not recognize
strokes.
Trang 7review Questions
1 How do you load external Flash content?
2 What are the advantages of loading external Flash content?
3 How do you control the Timeline of a movie clip instance?
4 What is a mask and how do you create one?
review answers
1 You use ActionScript to load external Flash content You create two objects: a Loader
and a URLRequest The URLRequest object specifies the filename and file location of
the SWF file that you want to load To load the file, use the load() command to load
the URLRequest object into the Loader object Then display the Loader object on the
Stage with the addChild() command
2 Loading external content keeps your overall project in separate modules and prevents
the project from becoming too bloated and difficult to download It also makes it
easier for you to edit, because you can edit individual sections instead of one, large,
unwieldy file
3 You can control the Timeline of movie clips with ActionScript by first targeting them
by their instance name After the name, type a dot (period), and then the command
that you desire You can use the same commands for navigation that you learned in
Lesson 6 (gotoAndStop, gotoAndPlay, stop, play) Flash targets that particular
movie clip and moves its Timeline accordingly
4 Masking is a way of selectively hiding and displaying content on a layer In Flash, you
put a mask on the top Mask layer and the content in the layer below it, which is called
the Masked layer Both the Mask and the Masked layers can be animated To see the
effects of the Mask layer on the Masked layer, you must lock both layers
Trang 8Documents
lesson overview
In this lesson, you’ll learn how to do the following:
• Test a Flash document
• Understand the Bandwidth Profiler
• Change publish settings for a document
• Understand the difference between export file types
• Add metadata
• Publish a SWF file and its HTML file
• Detect the version of Flash Player a viewer has installed
•
Publish a self-contained projector file
This lesson will take less than an hour to complete If needed, remove the previous lesson folder from your hard drive and copy the Lesson10 folder onto it
Trang 9ptg
Trang 10getting started
In this lesson, you’ll publish an animation that has already been completed The project is an animated banner for the familiar fictional city of Meridien, whose interactive restaurant guide you created in Lesson 6, and whose realtor site you created in Lesson 7 You’ll publish the movie for the Web, capture specific frames
as images, and save the movie so that even viewers who don’t have the Flash Player can see it
1 Double-click the 10End.html file in the Lesson10/10End folder to open the finished project
A Web browser launches and plays the HTML file, which displays the SWF file The HTML file tells the browser how to show the SWF file Quit the Web browser
2 Double-click the 10Start.fla file in the Lesson10/10Start folder to open it in Flash
The project displays video, images, and motion tweens, and all the assets are contained within the FLA file
3 Choose File > Save As Name the file 10_workingcopy.fla and save it in the 10Start folder Saving a working copy ensures that the original start file will be available if you want to start over
testing a Flash Document
Troubleshooting is a skill you develop over time, but it’s easier to identify the cause
of problems if you test your movie frequently as you create content If you test after