ActionScript - General Undo / Redo API?

回眸只為那壹抹淺笑 提交于 2019-12-08 05:09:37

问题


i've been unsuccessfully attempting to create my own undo/redo classes that work well with any type of possible undo and redo commands.

for example, my simple class works perfectly with undoing/redoing x and y positions of display objects or undoing/redoing values of sliders, etc., but things get dicey when i try to tailor my classes to also work with things like adding and removing items to a list.

is there any well known and well documented solution for general undoing and redoing for actionscript (without Flex)?


回答1:


There are specific design patters for this kind of stuff in AS3

Please check the following links: http://lucamezzalira.com/2010/01/12/memento-pattern-in-actionscript-3-undoredo/

you can also check Command pattern, which is the de-facto standard ,irrespective of the programming language, it would give you the basics.

Incase you face any issues, please feel free to comment.



来源:https://stackoverflow.com/questions/4713172/actionscript-general-undo-redo-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!