Reverse startDrag

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 :slight_smile:


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

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. :frowning:

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.

:slight_smile:

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

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 :frowning:

go for it, brotha… Im gonna go fishing. :slight_smile:

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

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:

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! :slight_smile: