# Drag n' drop problems (script inside)

**URL:** <https://forum.kirupa.com/t/drag-n-drop-problems-script-inside/123533>\
**Category:** Uncategorized\
**Created:** [September 24, 2004, 2:53pm UTC](https://forum.kirupa.com/t/drag-n-drop-problems-script-inside/123533 "2004-09-24T14:53:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricLanteigne](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@EricLanteigne](https://forum.kirupa.com/u/EricLanteigne)\
**Post date:** [September 24, 2004, 2:53pm UTC](https://forum.kirupa.com/t/drag-n-drop-problems-script-inside/123533/1 "2004-09-24T14:53:58Z")

</div>

[font=Arial]Hi all!

I have a problem with my drageable object when the users drag the object outside the limit of the Flash stage in a HTML page. It seem like it lose it’s \_.x and .\_y coordonates. It will followed the cursor when it returns to the stage but it can be drop anywhere on the stage after that.

Anybody have a solution to how I could detect when the piece is going outside the stage and make it return to its original place?

Here’s the script on my object :

on (press) {  
this.startX = this.\_x;  
this.startY = this.\_y;  
this.startDrag();  
}  
on (release) {  
this.stopDrag();  
if (getProperty("/b", \_droptarget) eq “/b1”) {  
this.\_x = eval(this.\_droptarget).\_x+0;  
this.\_y = eval(this.\_droptarget).\_y;  
} else {  
this.\_x = this.startX;  
this.\_y = this.startY;  
}  
}

Here’s the Flash movie in question : [/font][[font=Tahoma][color=#004477]Drag Drop Flash Movie[/color][/font]](http://www10.brinkster.com/EricLanteigne/FlashProblem.htm)

[font=Arial]Do you have a better way to script an drag n’ drop object that doesnt need absolute positioning?

Thanks,  
Eric Lanteigne [/font]
