Viewers: in countries Watching now:
In Flash Professional CS5: Code Snippets and Templates in Depth, David Gassner shows designers how to use Flash Professional CS5's Code Snippets panel and file templates to get started with ActionScript 3 and implement best practices. This course describes how to insert snippets into existing Flash presentations, includes a detailed explanation of the code behind the snippets, and shows how to use the many templates included with Flash Pro CS5 to quickly create customized presentations. Exercise files are included with the course.
One of the most popular effects that Flash designers like to incorporate into their presentations is a Panning landscape. An example of this is available in Flash Professional CS5's New File templates in a template named Panning which you'll find in the Sample Files category. I'll create a new file based on this template and then test it. This is a very simple template with three layers, each of which has its own motion tween. The foreground layer shows grass moving at a fast rate, the medium layer shows hills floating by at a slower rate, and the background layer shows clouds moving by at a slow rate.
Now, I'll close the test movie and show you how this is architected. There are three layers, each of which contains a movie clip symbol, and a motion tween. The foreground has the grass, the mid ground the hills, and the background the clouds. I am only interested in the clouds for this example, so I'll right-click on the background layer, and select Hide Others, and then right-click again on the background layer and choose Lock Others. That results in selecting everything in the background layer.
Now, I am going to press the Enter key, and show you the animation once, that the clouds move by at a slow rate moving from left to right. I want to use this cloud symbol and the motion tween layer and incorporate all that into my own presentation. So I'll right-click into the background layer, and select Copy Frames, and now the graphic and the motion tween and all the associated frames are in the Clipboard. Then I'll open a file from the Exercise Files area.
The name of the file is logoWithPanning.fla and it's available in the Ch08_SampleFiles folder. I am going to add my clouds symbol into this presentation, but I am going to wrap it in its own movies clip symbol, so that with its own timeline the clouds can move continuously even while the movie's main timeline is static. So I'll go to the Library, right-click on it and choose New Symbol and I'll name the new symbol mcClouds and set its Type as Movie Clip. I'll click OK, then I'll right-click in Frame 1 of the default layer, and paste the copied frames.
Everything about the moving clouds is now inside the Movie Clip symbol. I'll go back to the main Timeline by clicking on Scene 1. I am going to place the clouds into their own layer above the background but behind the sun, hill, bridge, and so on. So I'll right-click on the background layer and choose Insert Layer. I'll double-click on the layer name and name it clouds, I'll right-click on the new layer, and choose Lock Others, and then I'll drag the mcClouds symbol into my new layer.
Now, I am going to drag this symbol down a little bit and then over so that its top-right corner aligns with the top -right corner of the presentation. Then I'll run the movie. You'll see the clouds moving by effectively, but you'll notice that the clouds still flicker, and that's because of the same problem that existed in the New File template, that the state of the graphics at the end of the timeline and at the beginning of the timeline don't match exactly. This is a very common issue when dealing with panning landscapes.
So here are some fixes you can apply. I am going to make some changes to the movie clip symbol, mcClouds. I'll double-click mcClouds in the Library panel, and then in the Timeline, I'll select the first frame. With the first frame selected I'll click on the clouds background and set the X value to -300. That will result in moving the clouds off of the visual screen. When the movie clip starts playing, the clouds will appear for the first time, and then, I'll move the cursor to the end of the timeline at frame number 100.
I'll once again click on the clouds, and I'll set the X position here to 1000, and that moves the clouds entirely off the screen. I'll go back to Scene 1, and I'll play the movie. The result of this is that the clouds are moving much faster, but you'll also see that the clouds aren't broken up or spliced during the playing of the movie. There is one last problem to solve though, and that's the entire image is moving off the screen, showing the white background of the movie.
So here's the final step to fix it. I'll close the test movie, and then go to Modify > Document. I'll set the background color of the document to the same color that contains the clouds. I'll click on the color selector and then drag the eyedrop down to the cloud color, and release, and click OK. Now, the document background exactly matches the color of the sky that's incorporated into the cloud image. I'll run the presentation again and here is the result.
The clouds are moving cleanly across the screen. There doesn't seem to be any perceptible break in the animation because I am allowing the beginning and ending of the movie to not have any clouds at all. To slow down the clouds, you would go into the movie clip symbol, and expand the size of the motion tween, slowing down the internal animation of the movie clip symbol, but you wouldn't have to do anything to the main timeline because it only contains a single frame, and in that frame you have a single instance of the mcClouds movie clip symbol, which is doing the animation.
So this is a great example of how you can learn the best techniques for accomplishing basic effects using the New File templates. Then with a little bit of creative copying and pasting and minor modifications to the document and its movie clip symbols, you can incorporate those effects into your own Flash movies.
There are currently no FAQs about Flash Professional CS5: Code Snippets and Templates in Depth.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.