Graphics Programs Reference
In-Depth Information
Exercise 9.1: Creating a Filled Planar Object
In this exercise, we will extend the previous discussion to include filling a planar object
with color. We will also consider more complicated shapes with holes. To view the fin-
ished results of this exercise, open 9_1_planarFillsDONE.swf in the Chapter 9 folder.
You should be able to get results similar to Figure 9.6.
Figure 9.6 Sample screen from 9_1_planarFillsDONE.swf
Step 1: Getting started
We'll begin where we left off, so open 9_1_planarFills.fla in the Chapter 9 folder.
This file contains the script that we just discussed.
To fill the interior of the shape, we just need to add two lines of code as shown. There
are two parameters for the beginFill() method. The first parameter is a hexadecimal
color value. The second parameter is an optional alpha value. In our case,
beginFill(0x00aaff,75)
specifies a blue (with some green) at a 75% opacity (line 173). You will also need to
insert an endFill() method to tell Flash when to stop filling in the interior of the object
(line 180). Save your movie as 9_1_planarFillsDONE.fla and check that the letter is
filled as specified. Two lines of code. It doesn't get much easier than that!
Search WWH ::




Custom Search