STEP 05 the script object: INITIALIZE SCRIPT


The Initialize script in the Script movie clip is the script that gets called before anything else in the movie, normally in the first frame. In the ManiFestival movie, we use the Initialize script to load the Subway and Tunnel movies.

To create the Initialize script, follow these steps:

  1. Open the Script movie clip from the Library.

  2. Open the Library and Select the Scripts movie clip.

  3. Double-click to open.

  4. On any frame, insert a keyframe and double-click it to open the Frame Properties dialog.

  5. Select the Label panel and enter Initialize in the Name field.

  6. Select the Actions panel.

  7. Click the Add Actions button and select the Load/Unload Movie option.

    Notice that the Load/Unload Movie options are displayed on the right of the Actions panel.

  8. Select the Load Movie into Location option.

  9. Enter the name of the Flash movie in the URL text area. The first movie is tunnel.swf.

  10. Select the Target option under Location and enter the name of the target in the adjacent text field. In this example, the name of the target is /tunnel, as shown in figure 08:20.


    Figure 08:20.

    graphics/08fig20.jpg


  11. Repeat steps 710 to load the second movie. For Mani-Festival, subway.swf is loaded into target /subway.

When you're finished, your initializing code should look like this:

  Load Movie ("tunnel.swf", "/tunnel")   Load Movie ("subway.swf", "/subway")  

Note

load variables

In the Load Movie dialog, you'll notice an option called Load Variables. I didn't need to use the Load Variables option for this example, but it's a powerful new function you should be aware of.

With this, a set of variables is passed from the location listed in the URL field, which allows the server to dynamically update a Flash movie. Or, more specifically , it allows a Flash movie to update itself from the server-side script by calling it. When these options are used, the URL location is typically a CGI or other server-side script. It can also refer to an external text file. Variables returned from a server-side script or text file are listed in URL encoded strings. Consider the following:

  "myvariable=100&myvariable2=test&myvarialbe3=ok"  

By calling this server-side script or text file, the variables myvariable, myvariable2, and myvariable3 are now set to "100," "test," and "ok," respectively, in your movie.




Flash Web Design The Art Of Motion Graphics
Flash Web Design oder: the art of motion graphics
ISBN: 3827256623
EAN: 2147483647
Year: 2005
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net