A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Limit the moving area

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    15
    I have a object that as a code that makes the object move like if it was the mouse. A drag and hide mouse cursor kind of code.
    But i want to limit the area of moving. i don´t want it to stop drag, i want that if the object passes in to none permitid area it stops.
    Like a car in a city hat can go out of the road.
    Did i make myself clear??
    Thanks for your help guys.

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Location
    Australia
    Posts
    379
    You can stipulate a "bounding box" when using startDrag().

    For example:
    Code:
    onClipEvent (mouseDown){
      this.startDrag(true,15,15,500,250);
    }
    "true" will lock the cursor to the middle of the Movie Clip and the numbers are coordinates for the bounding box (rectangle) that the object is confined to.

    the first (15) is the left
    the second (15) is the top
    the third (500) is the right
    the forth (250) is the bottom

    You can see a VERY OLD ver2.8 example here:
    http://www.bridel.org/koolmoves/demo.../dragdrop.html

    Hope that helps a little...

    Hilary

    --

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center