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

  • Home
  • SEARCH
  • 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 7585129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:05:55+00:00 2026-05-30T19:05:55+00:00

Can someone please help in recording movements while dragging an object and when the

  • 0

Can someone please help in recording movements while dragging an object and when the object is dropped the record event will stop and the recorded movement will be animated by Play button.

  • 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-30T19:05:57+00:00Added an answer on May 30, 2026 at 7:05 pm

    Set up an array that will store recorded information:

    var recording:Array = [];
    

    Set up a method that will add information to this Array:

    function record(target:MovieClip):void
    {
        recording.push(new Point(target.x, target.y));
    }
    

    Do this when you start dragging your object:

    recording.length = 0;
    
    addEventListener(Event.ENTER_FRAME, _record);
    function _record(e:Event):void
    {
        record(yourObject);
    }
    

    Do this when you stop dragging your object:

    removeEventListener(Event.ENTER_FRAME, _record);
    

    Do this when you click replay:

    recording.reverse();
    
    addEventListener(Event.ENTER_FRAME, _playRecording);
    function _playRecording(e:Event):void
    {
        var step:Point = recording.pop();
    
        yourObject.x = step.x;
        yourObject.y = step.y;
    
        if(recording.length < 1)
            removeEventListener(Event.ENTER_FRAME, _playRecording);
    }
    

    Storing your recorded data for later use:

    You can use this method to convert your recording array into a string:

    function collapse(data:Array):String
    {
        var joined:Array = [];
    
        for each(var point:Point in data)
        {
            joined.push(Math.round(point.x) + ":" + Math.round(point.y));
        }
    
        return joined.join("$");
    }
    

    Which will end up something like:

    trace(collapse(recording)); // 48:47$29:19$4:26$20:35$1:48$3:16$12:24$27:30$0:24$19:48
    

    You’ll then be able to use this to create your recording array:

    function expand(data:String):Array
    {
        var out:Array = [];
        var base:Array = data.split("$");
    
        for each(var fragment:String in base)
        {
            var coords:Array = fragment.split(":");
            var point:Point = new Point(coords[0], coords[1]);
    
            out.push(point);
        }
    
        return out;
    }
    

    Which works like so:

    var previousData:String = "48:47$29:19$4:26$20:35$1:48$3:16$12:24$27:30$0:24$19:48";
    var recording:Array = expand(previousData);
    
    trace(recording); // (x=48, y=47),(x=29, y=19),(x=4, y=26),(x=20, y=35),(x=1, y=48),(x=3, y=16),(x=12, y=24),(x=27, y=30),(x=0, y=24),(x=19, y=48)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please help me on this find specific record Edit through MS access
Can someone please help me understand why this isn't working? The loading.gif appears while
Can someone please help me out with printing the contents of an IFrame via
Can someone please help me? In Perl, what is the difference between: exec command;
Can someone please help quickly mute or unmute the stage volume in Flash CS3
can someone please help me. why does this return an error: Dim stuff As
Can someone please help me with using Regex with NSPredicate? NSString *regex = @(?:[A-Za-z0-9]);
Can someone please help me out with a JavaScript/jQuery solution for this arithmetic problem:
Can someone please help me figure out a way to achieve the following (see
Could someone please help explain why I can't get this to work? I properly

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.