10.12.2012 Views

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

{}<br />

Mp3.as<br />

{}<br />

Media.as<br />

{}<br />

VideoFlash.as<br />

PlayVideo.as<br />

Figure 1-8. Relationships of <strong>com</strong>position, inheritance, and instantiation<br />

In turn, RecordVideo inherits from RecordMedia. At this point, we’re right back to the<br />

class to which the Media class first delegated, RecordMedia.<br />

Using <strong>com</strong>position without inheritance is difficult to imagine in most practical applications.<br />

Thus, instead of focusing on the relative advantages of each, for now consider<br />

<strong>com</strong>position and inheritance a team. In Chapter 11, we again consider this<br />

issue of favoring <strong>com</strong>position over inheritance in the context of using <strong>com</strong>position<br />

with design patterns.<br />

Maintenance and Extensibility Planning<br />

A number of years ago, we built a web site designed for change. At the time, no<br />

thought was given to design patterns, but instead we knew that the site would<br />

change based on experience, and were acutely aware of making sure that the site was<br />

set up for accepting change without having to redo it.<br />

This was a case where the plan worked too well. The site is easy to update and as a<br />

result, we really haven’t bothered to take the time to rework the site to incorporate<br />

new concepts. It’s starting to look a little old-fashioned, and we’d like to upgrade the<br />

version of Flash so that we can optimize video and all the new features in Flash CS3<br />

{}<br />

{}<br />

RecordVideo.as<br />

{}<br />

PlayMedia.as<br />

{}<br />

RecordMedia.as<br />

{}<br />

PlayAudio.as<br />

{}<br />

RecordAudio.as<br />

delegates<br />

Instantiates<br />

Inherits<br />

Maintenance and Extensibility Planning | 57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!