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

Chapter 8. Shared Objects > Shared Objects and Custom Classes

8.7. Shared Objects and Custom Classes

With a little extra work, you can store instances of a custom class in the slot of a shared object. For example, if you are developing a shared whiteboard, a shared object could contain all the shapes that define each graphic in the whiteboard. The client-side Rectangle class in Example 8-9 can be used to create a simple ActionScript Rectangle instance using the new operator that will draw itself into a movie clip. The Rectangle object can also be stored in a shared object slot so that other movies can use it to draw the same rectangle.

Registering the class using the Object.registerClass( ) method is the essential step that makes storing and calling methods on an instance of a class possible in a shared object slot.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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