- Designing Your Web Site to Be Modular
- Loading Movies or JPGs
- Task: Use Load Movie
- Determining When a Movie Is Fully Loaded and How to Unload It
- Task: Determine Whether a Movie Is Fully Loaded
- Shared Library Items
- Task: Prepare Items to Share at Runtime
- Task: Start Using a Shared Item
- Task: Update Shared Items in a Library
- Task: Share a Font During Runtime
- Linked Scripts
I want to mention the topic of linked scripts here because it fits very well with the other topics mentioned this hour. Remember all the ActionScripting you did in the Actions panel? Anything you can type in that panel can be stored as text in a text file. Let me just show you how it works.
After you've created your text file full of ActionScript, you can return to Flash. Use the Actions panel to select the Action "include" (under the plus button, Actions, Miscellaneous Actions) and specify, as its parameter, a named text file. For example, if in a keyframe you open the Actions panel and place the script #include "scripts.txt", Flash will use the contents of the file scripts.txt as if it were inside this keyframe. Presumably, the content of scripts.txt is a legitimate ActionScript. This is great because you can change the script without ever opening Flash. Just remember if you change the script file, you'll need to export the .swf again (as this is when the code is copied into Flash). This is a great feature.
One note: Macromedia suggests that you use ".as" as a file extension (instead of ".txt") so that everyone knows the file contains ActionScript. (Get it? The .as extension stands for ActionScript.)
Just like loadMovie and Shared Library items, external scripts let you modularize your projects for easy updates. The key is that you must plan for likely updates.