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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:45:20+00:00 2026-05-22T15:45:20+00:00

hey everyone, my code is listed below. as you can see, I have a

  • 0

hey everyone,
my code is listed below.

as you can see, I have a container MC which I have added to the stage. I set its drag constraints using a Rectangle(). I then add the ‘cat’ child movieclip to the container, and I want this to be dragable too. However, as soon as I click on my cat when testing the MC. It shoots to point x=0 y=0 on the stage and doesn’t move.

The container MC can be moved without any trouble.

If I remove the rectangle bounds from the containers startdrag() function. both MC’s can be dragged without any issue.

any help would be awesome.

thanks

//panning ability
my_x = 800 - myImage.width;
my_y = 480 - myImage.height;

myWidth = 0 - my_x;
myHeight = 0 - my_y;

container.addEventListener(MouseEvent.MOUSE_DOWN, bgMouseDown);
container.addEventListener(MouseEvent.MOUSE_UP, bgMouseUp);

 function bgMouseDown(evt:MouseEvent):void
{
    var object = evt.currentTarget;
    object.startDrag(false, new Rectangle(my_x, my_y, myWidth ,myHeight));
}

 function bgMouseUp(evt:MouseEvent):void
{
    var object = evt.currentTarget;
    object.stopDrag();
}

//adding ze cat

cat = new ACat();
container.addChild(cat);
cat.x = 100;
cat.y = 400;


cat.addEventListener(MouseEvent.MOUSE_DOWN, catMouseDown);
cat.addEventListener(MouseEvent.MOUSE_UP, catMouseUp);


 function catMouseDown(evt:MouseEvent):void
{
    var object = evt.currentTarget;
    object.startDrag(false);
}

 function catMouseUp(evt:MouseEvent):void
{
    var object = evt.currentTarget;
    object.stopDrag();
}
  • 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-22T15:45:21+00:00Added an answer on May 22, 2026 at 3:45 pm

    Try evt.stopPropagation( ) on the first line of the catMouseDown function.

    Also try cat.addEventListener(MouseEvent.MOUSE_DOWN, catMouseDown, true);

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

Sidebar

Related Questions

Hey everyone, I am having a little trouble debugging my code. Please look below:
Hey everyone, take a look at the code below and appreciate how messy the
Hey everyone... I'm not too familiar with PHP... but I have PHP code that
hey everyone, I have no errors in my app-code what so ever, but when
Hey everyone ;) I have a new question again :D I can open my
Hey everyone, I am expanding my team and I have recently added an additional
Hey everyone. The following is the code that I am using to play random
Hey everyone, in the following code, what should the result of d be after
Possible Duplicate: Why does simple C code receive segmentation fault? Hey Everyone, I'm sure
Hey everyone, I have achieved the effect described in the title using the following

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.