Skip to main content
Inspiring
November 16, 2006
Answered

Mouse Listener - Can't remove - Help!

  • November 16, 2006
  • 2 replies
  • 249 views
Here is the code I am using. In following frames it still is registering the mouse down for the mouse listener. How do I remove it? Thanks for your help in advance!

this.mouseListener = new Object (this);
this.mouseListener.onMouseDown = function () {
if (this.rightClick_mc.hitTest(_root._xmouse, _root._ymouse, true) != true) {
this.gotoAndPlay(69);
}
}
this.mouseListener.onMouseUp = function () {
this.Mouse.removeListener(this.mouseListener);
}
This topic has been closed for replies.
Correct answer
Use like this !

var mouseListener:Object = new Object (this);
mouseListener.onMouseDown = function () {
if (this.rightClick_mc.hitTest(_root._xmouse, _root._ymouse, true) != true) {
this.gotoAndPlay(69);
}
}
mouseListener.onMouseUp = function () {
Mouse.removeListener(mouseListener);
}

2 replies

ski_geekAuthor
Inspiring
November 17, 2006
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You saved me from having to rebuild the tutorial again!
Correct answer
November 17, 2006
Use like this !

var mouseListener:Object = new Object (this);
mouseListener.onMouseDown = function () {
if (this.rightClick_mc.hitTest(_root._xmouse, _root._ymouse, true) != true) {
this.gotoAndPlay(69);
}
}
mouseListener.onMouseUp = function () {
Mouse.removeListener(mouseListener);
}