• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Movie Clip Subclasses and Co... > Packaging Subclass Code and Library ...

14.4. Packaging Subclass Code and Library Symbols Together

With our superclass assigned, we've created a fully functioning MovieClip subclass, Ball. We can add methods and properties to it via Ball.prototype, just as we would with any class (as shown in Example 14-1). However, suppose we wanted to share our Ball class with another developer. We might sensibly put our class in an external .as file and tell the developer to #include the file. But we'd also have to tell her to make a Library symbol for the class and export that symbol as "ballSymbol". If the developer doesn't export the symbol, or if she exports it with the wrong linkage identifier, our class won't work.

Maintaining both a class file and an accompanying movie clip symbol can be inconvenient and error prone. To make a MovieClip subclass more self-contained, we can place our code inside the movie clip symbol itself, between the #initclip and #endinitclip pragmas (creating a so-called #initclip block).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint