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.

Figure 12-5. Extended example showing an infrared map of the West Coast<br />

Let’s look at the changes needed to update the model.<br />

Adding a New Model<br />

Instead of modifying the current weather maps model (Example 12-13), we will<br />

extend it to incorporate the new data and additional state information. We need to<br />

add another property to indicate the chosen map type, either a visible map or an<br />

infrared one. In addition, we need to update the application logic to work with the<br />

new data. Example 12-18 shows a new interface for the model that defines the methods<br />

required for the new features.<br />

Example 12-18. INewModel.as<br />

package<br />

{<br />

import flash.events.*;<br />

public interface INewModel extends IModel<br />

452 | Chapter 12: Model-View-Controller Pattern

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

Saved successfully!

Ooh no, something went wrong!