# Reverse startDrag

**URL:** <https://forum.kirupa.com/t/reverse-startdrag/6599>\
**Category:** Uncategorized\
**Created:** [October 11, 2002, 5:26pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599 "2002-10-11T17:26:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [October 11, 2002, 5:26pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/1 "2002-10-11T17:26:46Z")

</div>

is it possible to have the startDrag command enabled but rather than the object following the mouse around … for it to go in the exact opposite direction.

i have a map that i want the user to be able to look around on and i think it would feel more natural for them to feel like they were scrolling around the map … rather than dragging it around … so i would like to be able to have the map move opposite of the mouse.

thanks in advance for the help gurus de flash 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 7:12pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/2 "2002-10-11T19:12:45Z")

</div>

* * *

## mymc.\_x = \_root.\_xmouse mymc.\_y = \_root.\_ymouse

## -is the same as startDrag(); the opposite would be like this…

## mymc.\_x = -\_root.\_xmouse mymc.\_y = -\_root.\_ymouse

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 8:07pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/3 "2002-10-11T20:07:06Z")

</div>

doesn’t work … i think it’s b/c the symbol i’m controlling isn’t centered … but the second i click … to startdrag . the symbol disappears i’m assuming b/c the -\_xmouse and -\_ymouse are off the screen. ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 8:11pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/4 "2002-10-11T20:11:40Z")

</div>

The reason it doesnt work is because the on(press) even does not move the items over time, that was the whole reason they created the startdrag. I think a function or prototype is called here, but I wouldnt take my word for it because Im seeing triple right now, and it has nothing to do with happy hour. Im just exhausted.

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 8:17pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/5 "2002-10-11T20:17:58Z")

</div>

So are you going to post the prototype Inigo or should I do it? 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 8:20pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/6 "2002-10-11T20:20:44Z")

</div>

i tried to add that as a function on a controller mc in my movie … but i couldn’t figure out how to stop the function ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 8:22pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/7 "2002-10-11T20:22:44Z")

</div>

go for it, brotha… Im gonna go fishing. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 8:36pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/8 "2002-10-11T20:36:42Z")

</div>

Here you go. Took me some time, I’d better go fishing with you…

```auto
MovieClip.prototype.startDragInv=function(){
	this.onEnterFrame=function(){
		var distx=_xmouse-Stage.width/2;
		var disty=_ymouse-Stage.height/2;
		this._x=Stage.width/2-distx;
		this._y=Stage.height/2-disty;
	}
}

// Usage:
square.onPress=startDragInv;

```

I supposed you wanted to have something symmetrical to the center of the scene…

pom :cowboy:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 11:49pm UTC](https://forum.kirupa.com/t/reverse-startdrag/6599/9 "2002-10-11T23:49:14Z")

</div>

Pretty cool, Pom… Fishing was great. Caugh two nice ones and had plenty of bites. Woohoo!

In the meantime, you put together this nice code. I’d like to talk about it some more. Perhaps later on!

Hats off to you, again, Amigo! 🙂
