design patterns

Memento Pattern – Recording State

Wednesday, February 25th, 2009 | examples | Comments

Here’s a little preview for the video I’m going to make tomorrow about the Memento Pattern.

To play with the .swf follows these steps:

1. Click the .swf to give it keyboard focus
2. Press the SPACE BAR to start your recording
3. Move the MOUSE around to change the red circle’s position
4. Press the SPACE BAR again to stop the recording
5. Press the LEFT and RIGHT keys to rewind and fast forward through actions you took

Neat trick, huh? :)

source

Tags:

Command Pattern – Queuing Commands

Tuesday, February 24th, 2009 | examples | Comments

This is a slight variation of the previous example, with a much different result. If you look at the source you’ll see that only the click handlers of the buttons have changed.

Now, whenever you click a green, red, or blue button each action will queue up waiting for you to click the black button. Once you click the black button, every action queued up (meaning each circle waiting to be created) will execute all at the same time.

View Queued Commands example
source

Tags:

Command Pattern – Undo and Command Stack

Monday, February 23rd, 2009 | examples | Comments

As requested, here’s a demo of the command pattern in action. This example shows how to use the Command Pattern to undo an action. Please watch the video in the previous post before browsing through this source.

Try to focus on how the commands are all added into the command stack, then you’ll see how the stack can be used for undoing, redoing, logging actions, queuing actions, and all sorts of other useful stuff :)

Click on the green, red, and blue boxes to create new circles. Click on the black box to undo.

source

Tags:

ActionScript 3 – Command Pattern and Interfaces

Friday, February 20th, 2009 | ActionScript 3, tutorials, videos | Comments

Click to view the video in a pop-up. Right-click and “save as” to download the video to your hard drive.

Watch Video Tutorial on Command Pattern and Interfaces

Please consider donating $1 if you learned something valuable from this video. The money will go directly towards covering the costs of hosting the videos. I sincerely thank the few of you who have donated so far.


Tags:

Search

Recommended Books

Speaking at FITC Toronto

 

March 2010
M T W T F S S
« Jan    
1234567
891011121314
15161718192021
22232425262728
293031  

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

Loading ... Loading ...