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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:14:53+00:00 2026-05-25T12:14:53+00:00

I have an application where a user uploads an image and then transforms it

  • 0

I have an application where a user uploads an image and then transforms it by clicking, dragging and using a resize bar. But my client has asked me to limit where the user can drag to, this is not a problem except I need the limits the opposite way around to what would be considered normal.

So where I have startDrag(false, new Rectangle…) that works just fine, but what I need is to let the user be able to drag outside of the boundaries and not have white space on the inside of the flash file.

What I mean by this is say I have a 500px wide flash file and an image inside it which I’m carelessly dragging around. If the images right hand edge (if I drag left) hits 500px it stops dragging and does not allow them to pull it any further left.

I truly hope I’ve explained this well, any guidance would be awesome!

Below is the code I currently have for the drag events.

Any help would be really appreciated.

public function startImageDrag (e:MouseEvent):void {
        mousePos['x'] = e.target.mouseX;
        mousePos['y'] = e.target.mouseY;
        imageDraggable.removeEventListener(MouseEvent.MOUSE_DOWN, function ():void {});
        photoapp.cStage.addEventListener(MouseEvent.MOUSE_MOVE, moveImage);
        photoapp.cStage.addEventListener(MouseEvent.MOUSE_UP, endImageDrag);
    }
    //The type is wildcarded because I have this hooked to MOUSE_LEAVE too
    public function endImageDrag (e:*):void {
        photoapp.cStage.removeEventListener(MouseEvent.MOUSE_MOVE, moveImage);
        photoapp.cStage.addEventListener(MouseEvent.MOUSE_DOWN, startImageDrag);
    }

    public function moveImage(event:MouseEvent):void {
        //Get the offset of the current mouse position over the image
        var
            //The mouse position on the stage
            sxOff:Number = photoapp.cStage.mouseX,
            syOff:Number = photoapp.cStage.mouseY,
            //The position on which the mouse down event was on the image
            reX:Number = sxOff - mousePos['x'],
            reY:Number = syOff - mousePos['y'],
            //The iamge object
            i:DisplayObject = imageDraggable;

        //Move the image
        if (/*I have no idea now...*/) {
            imageDraggable.x = reX;
        }
        if (iY) {
            imageDraggable.y = reY;
        }

        event.updateAfterEvent();
    }
  • 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-25T12:14:54+00:00Added an answer on May 25, 2026 at 12:14 pm
    // this code will limit the movement to 100 pixels to the right
    var bounds:Rectangle = new Rectangle( 0,0,100,0)
    imageDraggable.startDrag( false,bounds );
    

    [EDIT]
    Maybe this will help you some more understanding

    var boundsWidth:Number  = stage.stageWidth  - pictureHolderMC.width );
    var boundsHeight:Number = stage.stageHeight - pictureHolderMC.height );
    var bounds:Rectangle = new Rectangle(0, 0, boundsWidth, boundsHeight);
    pictureHolderMC.startDrag(false, bounds); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application in which a user has to upload images to
I have a rails application where each user has a separate database. (taking Joel
I have an AppEngine application that uses the blobstore to store user-provided image data.
I have an application where I need the user to upload a photo. After
I have an application where the user selects the dates of a first statement
We have a current application where user login credentials are stored in a SQL
We have a customer that would like to modify application user messages that we
We have an application containing a lot of user controls that update frequently based
I have an application that requires the user to reenter their password between 15
I have an application where for each object the user can specify his own

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.