flashx.undo

# UndoManager - AS3

Package | flashx.undo
Class | public class UndoManager
Inheritance | UndoManager Object
Implements | IUndoManager

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The UndoManager class manages the history of editing operations on a text flow so that these operations can be undone and redone.

The undo manager maintains two stacks of IOperation objects. When a reversible operation is executed, it is placed on the undo stack. If that operation is undone, it is removed from the undo stack, reversed, and placed on the redo stack. Likewise, if that operation is then redone, it is removed from the redo stack, re-executed, and then placed onto the undo stack again. If another operation is executed first, the redo stack is cleared.

If the TextFlow is modified directly (not via calls to the edit manager, but directly via calls to the managed FlowElement objects), then the edit manager clears the undo stack to prevent the stack from getting out of sync with the current state.

Related API Elements

flashx.textLayout.edit.EditManager

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | undoAndRedoItemLimit : int The maximum number of undoable or redoable operations to track. | UndoManager

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | UndoManager() Creates an UndoManager object. | UndoManager
|  | canRedo():Boolean Indicates whether there is currently an operation that can be redone. | UndoManager
|  | canUndo():Boolean Indicates whether there is currently an operation that can be undone. | UndoManager
|  | clearAll():void Clears both the undo and the redo histories. | UndoManager
|  | clearRedo():void Clears the redo stack. | UndoManager
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | peekRedo():IOperation Returns the next operation to be redone. | UndoManager
|  | peekUndo():IOperation Returns the next operation to be undone. | UndoManager
|  | popRedo():IOperation Removes the next operation to be redone from the redo stack, and returns it. | UndoManager
|  | popUndo():IOperation Removes the next operation to be undone from the undo stack, and returns it. | UndoManager
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | pushRedo(operation:IOperation):void Adds a redoable operation to the redo stack. | UndoManager
|  | pushUndo(operation:IOperation):void Adds an undoable operation to the undo stack. | UndoManager
|  | redo():void Removes the next IOperation object from the redo stack and calls the performRedo() function of that object. | UndoManager
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | undo():void Removes the next IOperation object from the undo stack and calls the performUndo() function of that object. | UndoManager
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### undoAndRedoItemLimit

property

`undoAndRedoItemLimit:int`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The maximum number of undoable or redoable operations to track.

To disable the undo function, set this value to 0.

Implementation
`public function get undoAndRedoItemLimit():int`
`public function set undoAndRedoItemLimit(value:int):void`
Constructor Detail

### UndoManager

()
Constructor

`public function UndoManager()`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Creates an UndoManager object.

Method Detail

### canRedo

()
method

`public function canRedo():Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Indicates whether there is currently an operation that can be redone.

Returns

| `Boolean` — Boolean `true`, if there is an operation on the redo stack that can be redone. Otherwise, `false`.

### canUndo

()
method

`public function canUndo():Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Indicates whether there is currently an operation that can be undone.

Returns

| `Boolean` — Boolean `true`, if there is an operation on the undo stack that can be reversed. Otherwise, `false`.

### clearAll

()
method

`public function clearAll():void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Clears both the undo and the redo histories.

### clearRedo

()
method

`public function clearRedo():void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Clears the redo stack.

### peekRedo

()
method

`public function peekRedo():IOperation`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Returns the next operation to be redone.

Returns

| `IOperation` — The redoable IOperation object, or `null`, if no redoable operation is on the stack.

### peekUndo

()
method

`public function peekUndo():IOperation`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Returns the next operation to be undone.

Returns

| `IOperation` — The undoable IOperation object, or `null`, if no undoable operation is on the stack.

### popRedo

()
method

`public function popRedo():IOperation`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Removes the next operation to be redone from the redo stack, and returns it.

Returns

| `IOperation` — The redoable IOperation object, or `null`, if no redoable operation is on the stack.

### popUndo

()
method

`public function popUndo():IOperation`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Removes the next operation to be undone from the undo stack, and returns it.

Returns

| `IOperation` — The undoable IOperation object, or `null`, if no undoable operation is on the stack.

### pushRedo

()
method

`public function pushRedo(operation:IOperation):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Adds a redoable operation to the redo stack.

Parameters

| `operation:IOperation`

### pushUndo

()
method

`public function pushUndo(operation:IOperation):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Adds an undoable operation to the undo stack.

Parameters

| `operation:IOperation`

### redo

()
method

`public function redo():void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Removes the next IOperation object from the redo stack and calls the performRedo() function of that object.

Related API Elements

flashx.textLayout.edit.IEditManager.redo()

### undo

()
method

`public function undo():void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Removes the next IOperation object from the undo stack and calls the performUndo() function of that object.

Related API Elements

flashx.textLayout.edit.IEditManager.undo()

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00