Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6811823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:22:27+00:00 2026-05-26T20:22:27+00:00

I am going to create an application in that i have to implement an

  • 0

I am going to create an application in that i have to implement an Undo and Redo feature.
In the application there will be multiple objects located on stage and user can customize
the position of the objects. But when user clicks on Undo the object go back to their default
position and after clicking on redo object will move on the new position.

So my question is how can i apply these feature in my application?
Is there any library or any third party classes?

Can some one help me?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:22:28+00:00Added an answer on May 26, 2026 at 8:22 pm
     package com
     {
        import flashx.undo.IOperation;
    
        public class UndoOperation implements IOperation
        {
    
        private var _previousX:Number = 0;
        private var _previousY:Number = 0;
        private var _previousObj:Object = new Object();
        private var _currentX:Number = 0;
        private var _currentY:Number = 0;
        private var _currentObj:Object = new Object();
        private var _shape:Object = new Object();
    
    
        public function TransformOperation(currentObj:Object,previousObj:Object,previousX:Number, previousY:Number, currentX:Number, currentY:Number)
        {
            _previousX = previousX;
            _previousY = previousY;
            _previousObj = previousObj;
    
            _currentX = currentX;
            _currentY = currentY;
            _currentObj = currentObj;
            _shape = _currentObj;
    
            trace('Transform _previousX:  '+  _previousX  +' _previousY:  ' +_previousY+' _currentObj '+_currentObj+' _shape '+_shape);
            trace( 'trans _currentX    '+ _currentX +'  '+'_currentY     '+ _currentY );
    
        }
    
        public function performUndo():void
        {
            _shape = _currentObj;
            //trace('_shape.x '+_shape.x+" _shape.y "+_shape.y);
            _shape.x = _previousX;
            _shape.y = _previousY;
            //trace(_previousX +'  '+ _previousY +'  '+ _previousWidth +'  '+ _previousHeight +'  '+  _previousScaleX +'  '+  _previousScaleY +'  '+ _previousRotation);
            //trace('_shape.x '+_shape.x+" _shape.y "+_shape.y);
            //trace('_currentX    '+ _currentX +'  '+'_currentY     '+ _currentY);
        }
    
        public function performRedo():void
        {
            _shape.x = _currentX;
            _shape.y = _currentY;
            trace(_currentX+'  '+ _currentY);
        }
      }
    }
    

    This is my customize class afor undo and redo multiple objects on stage. There is different pattern which can be used for the undo and redo operation but for me this is the simple way for undo and redo. I have perfectly and successfully implement this in my project.

    To Use this class only import the class

                     import flashx.undo.UndoManager;
    

    and after that

                public static var _undo:UndoManager=new UndoManager();
                public static var _redo:UndoManager=new UndoManager();     
                public static var PrevX:Number=0;
                public static var PrevY:Number=0;
                var operation:TransformOperation = new TransformOperation(this,this,PrevX,PrevY,this.x,this.y);
               _undo.pushUndo(operation);
    

    After that create click event for undo and redo:

        public static function Undo(e:MouseEvent):void
        {
            _redo.pushRedo(_undo.peekUndo());
            _undo.undo();
            if(_undo.peekUndo()==null)
            {
                PlayerPosition.getClass.getChildByName("toolbar_mc").getChildByName("undo_mc").removeEventListener(MouseEvent.CLICK,Undo);
            }
            PlayerPosition.getClass.getChildByName("toolbar_mc").getChildByName("redo_mc").addEventListener(MouseEvent.CLICK,Redo);
        }
    
        public static function Redo(e:MouseEvent):void
        {
            _undo.pushUndo(_redo.peekRedo());
            _redo.redo();
            if(_redo.peekRedo()==null)
            {                          PlayerPosition.getClass.getChildByName("toolbar_mc").getChildByName("redo_mc").removeEventListener(MouseEvent.CLICK,Redo);
            }
            PlayerPosition.getClass.getChildByName("toolbar_mc").getChildByName("undo_mc").addEventListener(MouseEvent.CLICK,Undo);
        }
    

    For me this works fine… Hope this helps others too…:)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am going to create a typical business application that will be used by
I am going to implement an application that is gathering data from Android device.
I am going to create a script that sends out an email. I am
I've got around 750+ users that I'm going to create mailboxes for. Should I
Going through the microsoft authentication tutorial listed here they have you create a master
Is there going to be a way with the 4.0 SDK to create a
I'm going to rebuild my Linux box [yet] again. I have to create a
I'm attempting to design a system that will allow the processing of multiple types
Overview: I am looking to create a site that will centralize a lot of
I have an application that uses MSMQ for asynchronous processing of certain things. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.