When button1 is clicked, the cursor changes into a ‘movieclip’
I want this movieclip cursor to switch back into a regular cursor
when button1 is clicked again, so toggle the function on and off.
My question to you is, is it likely to use some kind of boolean here to toggle the function on and off or am I in the wrong direction?
Thanks in advance!
button1.addEventListener(MouseEvent.CLICK,wipe);
function wipe(e:Event):void
{
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,follow);
function follow(evt:MouseEvent)
{
cursor.x = mouseX;
cursor.y = mouseY;
}
}
Try
I’d move the definition of follow out of wipe. Does that even work?
If you need to have other listeners for MOUSE_MOVE directly on the stage then you might want to go with something more like:
Note: I’ve assumed you’re going to put your code into a document Class, since I always assume that if you care enough to ask on a place like Stack Overflow, you’d like to use good practice.