Project 8: Creating a Site with Effects
This project's website is slightly ambitious for the number of techniques that are used, but they are not difficult. You also get a bit of a break on the ActionScript for this chapter: not much code is used, and what you do add is very simple. Regardless, you probably feel comfortable with the basics after the last couple of chapters!You'll begin by setting up a website interface that includes animation when the SWF file first loads and when the navigation buttons first appear. You'll add several movie clip buttons that contain animation to the Stage. Then you'll add a transition that appears when your visitors navigate through the website, which includes an animated mask. Finally, you'll add scrollable text and videos as content for the site. You use ActionScript to control the buttons and transitions. You also use ActionScript to load FLV video and formatted text at runtime.
Exercise 1: Setting up the file
You first need to set up the website. This FLA file serves as a "container" file for the main content of the website. Despite this, it also contains the buttons, transitions, and other animations in the site.
1. Create a new Flash document and change the background color to #9CBC7C. Resize the Stage to 600 px wide by 300 px high and set the frame rate to 24 frames per second.2. Save the new Flash document as site.fla.3. In the Timeline panel, rename Layer 1 to bg tween. You'll use this layer to animate a semitransparent background that appears behind the other assets on the Stage.3. Create two new layers in the Timeline and name them actions and labels. Rearrange the layers so that the actions layer is the topmost layer, followed by the labels layer and finally the bg tween layer at the bottom of the layer stack (Figure 8.9).
Figure 8.9. Create five new layers on the Timeline.

Exercise 2: Creating the background animation
There are several animations in this example that build the "interface." They are almost entirely decorative instead of functional, but they enhance the overall look and feel of this website. Follow these steps to create a couple of tweens that fill in the background area of the site.
1. Select the Rectangle tool and set the stroke color to No Color. Set the fill color to #B6DB91. Draw a rectangle on the first frame of the bg tween layer and use the Property inspector to resize the rectangle to 400 pixels wide by 250 pixels high.2. Select the rectangle on the Stage and use the Align panel (Window > Align) to center the shape on the Stage. Make sure that the To Stage button is selected, and click the Align horizontal center button and the Align vertical center button to align the shape (Figure 8.10).
Figure 8.10. Center the rectangle on the Stage at frame 1.

Figure 8.11. Resize the rectangle on the Stage and insert a shape tween.
[View full size image]

Figure 8.12. Bend the left and right side of the rectangle.



Figure 8.13. Bend the left and right side of the rectangle.
[View full size image]


Exercise 3: Creating a background animation for the buttons
When the SWF file first loads in this animation, a box grows from left to right, and then drops vertically behind where the buttons animate in the SWF. This animation provides a backdrop for the buttons, but it's purely decorative. Despite being a decoration, it's a commonly used effect, which you'll learn how to create in this exercise.

1. Select the Rectangle tool, set the stroke color to No Color and set the fill color to a light green (#DDEDCB).2. Draw a small rectangle on the Stage and resize it to 3 pixels wide by 3 pixels high.3. With the shape selected on the Stage, press F8 to convert it to a symbol. Select the Movie clip behavior radio button and enter a symbol name of left_animation. Click OK.4. Right-click (Windows) or Control-click (Macintosh) the left_animation movie clip in the Library, and then select Edit from the context menu.5. In the Timeline, rename Layer 1 to animation, and create a new layer called actions. Drag the actions layer above the animation layer. Then, select frame 10 and press F6 to insert a keyframe.6. Select frame 10 of the actions layer, and open the Actions panel. Type the following code into the Script pane.
7. Select frame 5 of the animation layer and press F6 to create a new keyframe. Select the shape on frame 5 and set its width to 94 pixels using the Property inspector. Now the small box changes into a long rectangle. When you apply a shape tween, the small box appears to grow towards the right.8. Open the Property inspector. Select a frame between frames 1 and 4 of the animation layer and use the Tween pop-up menu in the Property inspector to insert a shape tween.9. Select frame 10 of the animation layer and press F6. Resize the shape to approximately 196 pixels wide by 68 pixels high (see the finished SWF for guidance).10. Use the Tween pop-up menu in the Property inspector to insert a shape tween between frames 5 and 10, and then scrub the Timeline to preview the animation. The box should appear to grow in size.11. Insert a new keyframe at frame 7 of the animation layer and then resize the rectangle to 60 pixels high.12. Make sure the rectangle is deselected. Move your mouse along the lower edge of the rectangle shape in frame 7 until your cursor changes to an arrow with a small curve beside it. Click the middle of the bottom edge of the shape, drag your cursor slightly upward, and release the mouse. This creates a slight random curve and sense of movement to the rectangle so that your animation doesn't look too "square" (Figure 8.14). If you want to make your shape a bit more irregular, you could even move the mouse cursor to the lower-left corner of the rectangle until your cursor changes again to an arrow with a corner angle icon beside it. Drag the left corner upward by a couple of pixels and then retest your animation.
stop();
Figure 8.14. Trading off margin for padding keeps the links from unexpectedly reflowing.

Figure 8.15. Position the movie clip on the Stage.
