Macromedia Flash Professional 8 Unleashed

Chapter 18. External ActionScript

IN THIS CHAPTER

  • Why Use External ActionScript?

  • #include Versus Classpath

  • Getting Started with External Class Files

  • Bringing It All Together

In earlier chapters, we covered the fundamentals of ActionScript 2.0 and debugging. Now we can begin to start taking ActionScript out of Flash and put it in external .as files. Some of the benefits include scalability and reusability; because the ActionScript is outside of Flash, it can be used by several different Flash files without you having to rewrite any of the code.

External .as files can be created with any text editor such as Notepad or SciTe and in the Flash authoring environment as well. You can also export directly from the Actions panel by selecting the options drop down and selecting Export script.

To create an external ActionScript file from scratch in Flash, choose File>New and choose ActionScript File. The stage will change to a large version of the Actions panel, which functions in much the same way as the standard Actions panel does in Flash, as you can see in Figure 18.1.

Figure 18.1. Create external ActionScript files from within Flash.

Категории