PDA

View Full Version : Arrow Movieclip = Mouse Pointer ?


fauzira
02-21-2007, 12:37 PM
Hi All,

It is possible to make auto mouse in Flash (i'm using Flash 8)?
I want to move a arrow movieclip that act as a mouse pointer.
I've done the moving script, but I dont have idea how to make the arrow movieclip act like a mouse pointer.. Any idea?

Thanks

FRA

Noct
02-21-2007, 02:46 PM
Lots of ways to do it. One of the top two are usually the best in most situations IMO.

onMouseMove = function (){
Mouse.hide();
my_mc._x=_root._xmouse;
my_mc._y=_root._ymouse;
updateAfterEvent();
}

Mouse.hide();
my_mc.onMouseMove = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
};

this.my_mc._x=_root._xmouse;
this.my_mc._y=_root._ymouse;
Mouse.hide();
onEnterFrame=function(){
this.my_mc.startDrag();
updateAfterEvent();
}

Mouse.hide();
startDrag(this.my_mc,true);

jsonchiu
02-22-2007, 04:15 AM
var myMouse:Object = new Object()
myMouse.onMouseMove = function()
{
my_mc._x = _xmouse;
my_mc._y = _ymouse;
}
Mouse.hide();
Mouse.addListener(myMouse);
my_mc._x = _xmouse;
my_mc._y = _ymouse;
Just paste that code into the frame (not on the object!)
That's the shortest and cleanest code I can think of.

fauzira
02-22-2007, 09:41 AM
Thanks All, my mistake.. I explain what I need on this thread http://www.actionscript.org/forums/showthread.php3?t=129018

anubus007
02-26-2007, 10:55 AM
hey i'm pretty new to action script stuff but i find that this works........

onClipEvent (enterFrame) {
setProperty(this, _x, _root._xmouse);
setProperty(this, _y, _root._ymouse);
Mouse.hide();
}


Hope that helps
-----Anubus------

Noct
02-26-2007, 04:04 PM
anubus, welcome aboard, but that isn't a different way to write it, it is just depreciated syntax.

It is the same as saying this:

onEnterFrame = function (){
my_mc._x=_root._xmouse;
my_mc._y=_root._ymouse;
Mouse.hide();
}

The only difference being that your code would have to be placed on the object, while the others we are discussing here go on the main timeline.