How to implement Undo Redo operation in flex 4 for maintain history?
I’m working with flex UIComponent and DisplayObjects for creating and editing diagrams,but
in flex there is no way to handle user operation history directly.
there is any idea to achieve this?
How to implement Undo Redo operation in flex 4 for maintain history? I’m working
Share
You could implement the Command Pattern for all actions with execute and undo methods, and queue them up.
so when the user wants to do some thing – lets say create an AddFiveToTotal class and executes:
This class would then be stored on a FIFO queue.
if the user needs to undo the command would be popped and the undo function called:
for redoability, don’t pop, just iterate the queue
also take a look at the Memento Pattern
If you are using any of the currently popular MVC(S) frameworks you will undoubtably find a util that some one has already created