code than you may want to deal with (Web hosting services)

code than you may want to deal with if you re new to Flash. For now, you might want to start out with a simple preloader using a few lines of more oldfashioned ActionScript code, which you can create by following these steps: 1. Create two scenes the second for your main movie and the first for the preloader. Or if your movie already has multiple scenes, add another scene for the preloader and make it the first scene. The scenes must be within the same movie. See Chapter 9 for the lowdown on creating and changing the order of scenes. 2. In the first scene (the preloader), create whatever you want your audience to see while the rest of your movie loads. Keep this scene simple so that it loads quickly. 3. Click the first frame of your preloader scene. Then choose Window. Actions to open the Actions panel if it isn t already open, and if necessary, click the collapse arrow on the title bar to expand it. In the Actions panel, click the Script Assist button to deselect it (if it s selected). 4. In the Script pane on the right side of the Actions panel, type in the following ActionScript code: if (_root._framesloaded >= _root._totalframes) { gotoAndPlay( Scene 2 ,1); } The ActionScript specifies that if the number of frames loaded is greater than or equal to the total number of frames in your movie (in other words, if the last frame of the main movie is loaded), the playhead of the Timeline should go to the first frame of the scene named Scene 2 and play it. Turn to Chapter 10 to find out about ActionScript. 5. Click the last frame of your preloader scene. 6. From the list of action types on the left side of the Actions panel, click the Global Functions category and then the Timeline Control subcategory; then double-click the gotoAndPlay action. gotoAndPlay(); appears in the Script pane on the right side of the Actions panel. 7. Type 1 in the Script pane. Now your code should look like this: gotoAndPlay(1); This ActionScript loops your preloader so that it plays over and over until your main movie is loaded. You can test your preloader by choosing Control.Test Movie, but your main movie might load so quickly that you don t even see the preloader. Choose View.Simulate Download to see how your preloader works while your main movie loads. (See Chapter 13 for more information on testing a movie and analyzing its download performance). You can also upload your file to a test Chapter 12: Putting It All Together 269
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Leave a Reply