Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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
Posted

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];
}
}
 
Share this answer
 
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900