ActionScript 3.0 Design Patterns
360 | Chapter 10: State Pattern tive Simulationby Jonathan Kaye and David Castillo (Thomson, 2003). While going back a few gener ...
Minimalist Abstract State Pattern | 361 the Play Button. In a typical video player application, the player will start over again ...
362 | Chapter 10: State Pattern For example, with a two-state machine (Play and Stop), the following pseudocode could direct the ...
Minimalist Abstract State Pattern | 363 As you can see, the behaviors (methods) have different implementations in the differ- en ...
364 | Chapter 10: State Pattern Initially, in lines 6-8, the script instantiates threeStateobjects—one of each of the two we des ...
Minimalist Abstract State Pattern | 365 By adding aVideoWorksinstance, we have a way to access the getter and setter meth- ods i ...
366 | Chapter 10: State Pattern To complete the state machine, we need to create the actual interface, and because the machine h ...
Video Player Concrete State Application | 367 Because the application at this stage only provides traces, you will need to use t ...
368 | Chapter 10: State Pattern In the followingStopStateclass shown in Example 10-8, you will note that the startPlay( )method ...
Video Player Concrete State Application | 369 Next, the context class shown in Example 10-10 for this design pattern pulls it al ...
370 | Chapter 10: State Pattern In addition to the classes that make up the State design pattern, you will need a copy of theNet ...
Video Player Concrete State Application | 371 To test the application, you’ll need an FLV file namedtest.flv. You can convert an ...
372 | Chapter 10: State Pattern Example 10-13. TestVid.as package { //Implement FMS2 App and Test State Machine #7 import flash. ...
Video Player Concrete State Application | 373 flv_txt.borderColor=0x9e0039; flv_txt.background=true; flv_txt.backgroundColor=0xf ...
374 | Chapter 10: State Pattern Open a new Flash document file, and in the center of the stage, draw a rectangle (W=320, H=240) ...
Expanding the State Design: Adding States | 375 and Pause Stop functions, a “Do Pause” behavior will be established to act diffe ...
376 | Chapter 10: State Pattern ThedoPause( )method is added to theStopState.asfile as shown in line 24, but it makes no sense t ...
Expanding the State Design: Adding States | 377 Next, the newPauseStateclass implements theStateinterface. ThedoPause( )func- ti ...
378 | Chapter 10: State Pattern As with the individual state classes, you also need to add aPauseStateinstance to the VideoWorks ...
Expanding the State Design: Adding States | 379 To test the additional pause class, all you need to do in the test class is add ...
«
15
16
17
18
19
20
21
22
23
24
»
Free download pdf