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

Part I: ActionScript Fundamentals > Movie Clip Subclasses and Components

Chapter 14. Movie Clip Subclasses and Components

In Chapter 12 we created a custom Ball class and used it to instantiate individual Ball objects. When it came time to display the ball objects, we were faced with several options. A separate Room class might contain balls and be responsible for drawing them on screen with the Drawing API. Or, a Ball object might have a property, mc, that contains a movie clip used to represent the ball. In some cases, it's redundant to have one object that represents a thing (such as a ball) and a separate movie clip object that displays it on screen. Movie clips, themselves, are already objects, so it often makes sense to use a movie clip to both describe an object and display that object on screen. In Flash MX, we can do so by creating a subclass based on the MovieClip class, thus creating a specialized type of object that provides built-in screen display.

In Flash 5, creating a MovieClip subclass involved an arduous series of workarounds that proved impractical for most developers. Flash MX introduces a formal MovieClip subclassing architecture that involves the following new features: #initclip, new MovieClip( ), Object.registerClass( ), and attachMovie( )'s initObj parameter.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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