The State Pattern – source files
I’m planning on doing a video tutorial on using the state pattern for better control over the state of your flash app. I put together what I’ll most likely use as the source files and I thought I’d share them here in case I don’t get around to making the video:
Part 1 – A typical “Document Class” approach to changing state
Focus on how it’s calling functions like “setStateAsWall()” to change state. Also notice how the .swf simply allows you to move from state to state.
View example
StatePattern – Part 1.zip
Part 2 – Adding the power of the State Pattern
Focus on how state is now changing using state.setStateAsWall(), then look into the individual State classes to set how they’re managing the state. In the .swf you’ll see you now how more control of how states move from state to state.
View example
StatePattern – Part 2.zip
Part 3 – Enforcing with an Interface
Focus on the interface “IState” (it’s like a class, but instead lists functions that any class that uses it has to have). Also notice that the State classes “implement” IState to enforce that they have the same functions. In the main class, you’ll see that they states are now typed as “IState”.
No change visually from part 2
StatePattern – Part 3.zip
I hope I get around to explaining this more later, but I thought I would push this up here before I go eat a bunch of turkey for Thanksgiving.
-
Brecht
-
John Lindquist
-
Icek
-
Guido
-
Icek
Search
Recommended Books
Speaking at FITC Toronto
Recent Posts
- Moving to johnlindquist.com
- AsyncCommand with Robotlegs, Signals, Flight, MinimalComps
- Search Widget – Robotlegs, Signals, Flight, Minimal Comps, Yahoo Astra
- FDT Super Awesome March Deal
- haXe Tutorial
- AS3 Signals Tutorial
- Preferred Video Tutorial Resolution?
- TweenMax – Tweening a timeline (Advanced Tweening)
- Robotlegs + Flight + Union Platform
- Back in the saddle
- Eclipse Theme Designer Preview
- RobotLegs Hello World Video Tutorial
- 10 Things Every Senior Flash Developer Should Know
- Efflex – 3D Effects for Flex
- MorphController – Mighty Morphing Papervision3D
Recent Comments
- software akuntansi terbaik on Back in the saddle
- loan rates on Augmented Reality – Recursive Webcam
- loan rates on Looking around the inside of a Sphere
- reverse phone lookup on Looking around the inside of a Sphere
- Oidhreachta on The Spotlight Effect (Dimming the unselected)
- Hosting company on archive
- aanbae on Back in the saddle
- Domain registration on Looking around the inside of a Sphere
- website designing company on Looking around the inside of a Sphere
- Honda Motor on Augmented Reality – Recursive Webcam
Categories
Archives
Preferred Video Tutorial Resolution
- 1024x768 (53%, 85 Votes)
- 1280x1024 (15%, 24 Votes)
- 1920x1080 (15%, 24 Votes)
- 800x600 (13%, 20 Votes)
- 480x320 (4%, 6 Votes)
- 640x480 (0%, 2 Votes)
Total Voters: 160


