ActionScript 3.0 Design Patterns

(Chris Devlin) #1

452 | Chapter 12: Model-View-Controller Pattern


Let’s look at the changes needed to update the model.


Adding a New Model


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


extend it to incorporate the new data and additional state information. We need to


add another property to indicate the chosen map type, either a visible map or an


infrared one. In addition, we need to update the application logic to work with the


new data. Example 12-18 shows a new interface for the model that defines the meth-


ods required for the new features.


Figure 12-5. Extended example showing an infrared map of the West Coast


Example 12-18. INewModel.as


package
{
import flash.events.*;


public interface INewModel extends IModel

Free download pdf