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 6073469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:16:27+00:00 2026-05-23T10:16:27+00:00

Thanks for the startdrag() suggestions, but I’m trying to avoid that atm I’m trying

  • 0

Thanks for the startdrag() suggestions, but I’m trying to avoid that atm

I’m trying to create a drag motion by using mouse_down then the mc = mouseX. Here is an image of the situation

But when I click, the mc always jumps to its registration point, which is the top left corner atm.

I can’t work my head around how to grab the current location of the mc. Note that the mc (all_mc) is wider than the stage.

Can someone please help me out?

this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

function mouseDownHandler(e:MouseEvent) {
    this.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}

function mouseMoveHandler(e:MouseEvent) {
    all_mc.x = mouseX;
}

Edit:

Ok I kind of worked out the x location of the mouse in relation to the registration point of the mc (the registration is at the top left):

Math.abs(stage.x - all_mc.x) + mouseX

But how to I select that point of on the mc?

  • 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-23T10:16:28+00:00Added an answer on May 23, 2026 at 10:16 am

    Modified Marty Wallace’s answer to handle the difference between where you click and the registration point:

    package {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class DummyTest extends Sprite {
    
            private var mDeltaX:Number = 0;
            private var mDeltaY:Number = 0;
    
            private var mGfx:Sprite;
    
            public function DummyTest() {
                mGfx = new Sprite();
    
                with(mGfx.graphics) {
                    beginFill(0x00FF00);
                    drawRect(0, 0, 200, 200);
                    endFill();
                }
    
                addChild(mGfx);
    
                addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
            }
    
            private function onMouseDown(e:MouseEvent) : void {
                mDeltaX = mGfx.x - mouseX;
                mDeltaY = mGfx.y - mouseY;
    
                addEventListener(Event.ENTER_FRAME, onEnterFrame);
                addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
            }
    
            private function onMouseUp(e:MouseEvent) : void {
                removeEventListener(Event.ENTER_FRAME, onEnterFrame);
                removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
            }
    
            private function onEnterFrame(e:Event) : void {
                mGfx.x = parent.mouseX + mDeltaX;
                mGfx.y = parent.mouseY + mDeltaY;
            }
        }
    

    }

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

Sidebar

Related Questions

I am trying to create a mc with drag function.My question is how to
I am trying to create to movable instances, that are draggable, and which have
Thanks everyone for the feedback Hi All, I'm am trying to create a stored
I need to develop my own drag function in AS3 (instead of using startDrag
thanks for your reading. I am trying to modify Jquery Nivo Zoom plugin to
I am trying to create a scroller...The videoSlider is my scrollBar and I want
I am new to jquery. I am trying to parse xml string using jquery.
Thanks in advance for taking the time to read this. Apologies that it is
Thanks to python-spidermonkey , using JavaScript code from Python is really easy. However, instead
thanks for reading! Here's what I'm up to. I'm writing a WordPress plugin that

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.