ActionScript-3 – Implementing withdrawal in Flex

How to implement undo and redo operations in flex 4 to maintain historical records?
I am using flex UIComponent and DisplayObjects to create and edit charts, but
in flex, it is not possible to directly process user operation history.
Any ideas to achieve this goal?
You can use execute and undo methods to implement Command Pattern for all operations and queue them.

So when the user wants to do something – let’s say create an AddFiveToTotal class and execute it:

public method execute():void{
totalModel.add( 5 );
)

Then store the class in the FIFO queue.

If the user needs to undo the command, the command will pop up and call undo function:

public method undo():void{
totalModel.subtract( 5 );
}

Redo, don’t pop up, just iterate the queue

Also take a look at Memento Pattern

If you are using any of the currently popular MVC(S) frameworks, you will undoubtedly find one Created tool library

How to implement undo and redo operations in flex 4 to maintain historical records?
I am using flex UIComponent and DisplayObjects to create and edit charts, but
in flex, it is not possible to directly process user operation history.
Any ideas to achieve this goal?

You can use execute and undo methods to implement Command Pattern for all operations and queue them.

So when the user wants to do something Time-let’s say create an AddFiveToTotal class and execute it:

public method execute():void{
totalModel.add( 5 );
}

Then store the class in the FIFO queue.

If the user needs to cancel the command, the command will pop up and call the undo function:

public method undo():void{
totalModel.subtract( 5 );
}

For redoability, don’t pop up, just iterate the queue

p>

Also take a look at Memento Pattern

If you are using any currently popular MVC(S) framework, you will undoubtedly find a tool library that has been created

Leave a Comment

Your email address will not be published.