Alternate Drag functions

I have made a small game with actionscript and want to attach a graphic or MC to the mouse but the actionscript for the game seems to conflict with the start drag function, does anyone know of other methods that I could use?

I’ve used this quite often:


 yourMc.onMouseMove = function() {
 	yourMc._x = _root._xmouse;
 	yourMc._y = _root._ymouse;
 	updateAfterEvent();
 };
 

:slight_smile:

do I attach this to the MC or graphic?

Oh… that code would have gone to a frame, and “yourMC” was the instance name of your movie clip.

 But you can do it like this too:

 //attach this onto your MC (that's going to replace the cursor!)
     
     onClipEvent (load) {
     	Mouse.hide();
     }
     onClipEvent (mouseMove) {
     	_x = _root._xmouse;
     	_y = _root._ymouse;
     	updateAfterEvent();
     }
     
 :thumb:

im afraid that didnt work (it does by itself!) Thanks anyway

Huh :huh: ?

What does what by itself?

You know, your post was quite empty…so I have no idea what you wanted to say :smiley:

But here’s a .fla of the code I posted above. Maybe it clears things up.

Zakalwe’s code is allright and it has to work, no doubt. :slight_smile:

theres also this:
http://proto.layer51.com/d.aspx?f=845
It may make it easier with the transition from using startDrag

try to throw away the updateafterevent() maybe :slight_smile: