ActionScript 3.0 Design Patterns
180 | Chapter 5: Adapter Pattern Example 5-1. Adaptee.as package { public class Adaptee { public function specificRequest( ):voi ...
Object and Class Adapters | 181 The client classMaincreates an instance of the adapter class and calls the method request( )defi ...
182 | Chapter 5: Adapter Pattern it. Extending the existing class allows the adapter to inherit its properties and methods. As i ...
Object and Class Adapters | 183 Example 5-5. Adaptee.as package { public class Adaptee { public function requestA( ):void { trac ...
184 | Chapter 5: Adapter Pattern The client would generate the following output. These aretracestatements that indicate which cl ...
Example: Car Steering Adapter | 185 methods and properties to accomplish what it needs to do. TheITargetinterface could declare ...
186 | Chapter 5: Adapter Pattern The Existing Class TheLegacyCarclass shown in Example 5-9 is a subclass of theSpriteclass, and ...
Example: Car Steering Adapter | 187 The parameterized constructor (lines 13-19) gets the initial location of the car throughxLoc ...
188 | Chapter 5: Adapter Pattern drawTire( )method (lines 34-39). The car is drawn so that itsregistration pointis in the center ...
Example: Car Steering Adapter | 189 ignition key of the car (assume that the car is in gear all the time). The setSteeringWheelA ...
190 | Chapter 5: Adapter Pattern The Adapter Class We now have a target interface. The next step is to figure out if an object o ...
Example: Car Steering Adapter | 191 TheCarAdapterclass implements theICarinterface and has a parameterized con- structor that re ...
192 | Chapter 5: Adapter Pattern right, and up arrow key down events, and calls turnMoreToTheLeft( ), turnMoreToTheRight( ), and ...
Extended Example: Steering the Car Using a Mouse | 193 Note that the new interface turns the car in discrete steps (50 degrees o ...
194 | Chapter 5: Adapter Pattern interceptkey downevents, we need to attach listeners to interceptmouse downand mouse moveevents ...
Example: List Display Adapter | 195 var listField = new TextField( ); listField.x = 20; listField.y = 20; var sList:String = "Br ...
196 | Chapter 5: Adapter Pattern The Adapter Class Before we implement theIListDisplayinterface, a decision regarding which type ...
Example: List Display Adapter | 197 TheListDisplayField adapter extends theTextField class, and implements the IListDisplayinter ...
198 | Chapter 5: Adapter Pattern requested location inaList(list inde xstarts at 1). This method checks to see if the delete loc ...
Extended Example: Displaying the O’Reilly New Books List | 199 This client code will display a text field located at point (20,2 ...
«
6
7
8
9
10
11
12
13
14
15
»
Free download pdf