在flex中实现撤消重做 [英] implement undo redo in flex

查看:194
本文介绍了在flex中实现撤消重做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..
我想要Flex中的撤消/重做功能,我得到了此链接,但是我不能使用此链接因为我必须为此使用库文件.我得到了另一个链接
但是它仍然不能像撤消/重做一样正常工作..
我该如何实现呢?
感谢

Hi..
i want undo/redo functionality in flex, i got this link this but i cant use this as i have to use library file for this. i got another link this,
but still its not properly working like undo/redo ..
how can i implement this??
thanks

推荐答案

private var currentIndex:int = 0;

私有函数txtTemplate_change():void
{
arrChanges.push(txtTemplate.htmlText);
currentDataIndex = arrChanges.length-1;
}

/**撤消更改**/
私有函数btnUndo_click():void
{
if(currentDataIndex> = -1)
{
txtTemplate.htmlText = arrChanges [currentDataIndex];
currentDataIndex--;
}
}

/**重做更改**/
私有函数btnRedo_click():void
{
if(currentDataIndex + 1< arrChanges.length)
{
currentDataIndex ++;
txtTemplate.htmlText = arrChanges [currentDataIndex];
}
}
private var currentIndex:int = 0;

private function txtTemplate_change():void
{
arrChanges.push(txtTemplate.htmlText);
currentDataIndex = arrChanges.length - 1;
}

/** Undo changes **/
private function btnUndo_click():void
{
if(currentDataIndex >= -1)
{
txtTemplate.htmlText = arrChanges[currentDataIndex];
currentDataIndex--;
}
}

/** Redo Changes **/
private function btnRedo_click():void
{
if(currentDataIndex+1 < arrChanges.length)
{
currentDataIndex++;
txtTemplate.htmlText = arrChanges[currentDataIndex];
}
}


第一个链接对我来说看起来不错.将SWC文件添加到您的库中并进行操作.

其他解决方案:自己编写组件.

它是一个文本字段,可检测键盘快捷键"ctrl&Z".它还存储了之前设置的值,并且如果使用快捷方式将当前值替换为所存储的值.应该没什么大不了的-如果有可用的库也很讨厌.
the first link looks fine to me. Add the SWC-File to your library and go for it.

Other solution: write the component yourself.

It''s a Textfield that detects the keyboard shortcut "ctrl & Z". It also stores the value that was set before and in case of shortcut replaces the current value with the stored. Should not be such a big deal - also it''s nasty if a library is available.


这篇关于在flex中实现撤消重做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆