Pattern for Undo functionality
Flex April 10th, 2009Yesterday someone asked me how to implement Undo functionality. I knew there was a pattern commonly used for this, but couldn’t remember it. In my common sense I would keep track of previous states of properties (or actions). After some search I found that Command pattern is a good choice to implement the Undo functionality.
With some online examples I implemented an undo functionality pattern in Flex. Doing such an exercise makes me understand the theory behind it better.
Here’s the first example. Right click on the swf to view the source.
Next is implementing redo functionality in it. In a third step I’ll try to make some things more generic so I can use it easily in our product.
What would also be interesting is to make the example work in a way that only whole words are undone instead of single characters. I’ll also look into that later on.
thx, Lieven Cardoen
Related: Memento Pattern
Recent Comments