View Full Version : MX: listener trips multiple times
lowprofile
June 26th, 2003, 09:11 AM
Hi,
I finally found the problem with this part... I have a listener on the mouse for button up. However, it trigger from 1 - 4 times !?!?!!! for one event?
What is with that? Is there a way to avoid this?
senocular
June 26th, 2003, 09:19 AM
some code would help
lowprofile
June 26th, 2003, 09:38 AM
myListener = new Object();
myListener.onMouseUp = function(){
if ( (this.button4.hitTest( _root._xmouse, root._ymouse, false))
|| (dont_close==true) ){
//Mouse is over the menu part don't close it
}
else{
close_menu();
}
dont_close = false;
}
Mouse.addListener(myListener);
Ignore the hitTest - that doesn't work either!!! It works for a movie clip but not a button??? However, Flash says it should work for buttons too...
dont_close gets set if the button is pressed because I have to try something else other than this hitTest since that doesn't work.
I put in traces and found that it works fine and only exectues once if I start it and just press that button.
Then once you try another button, you find that this button never works again and you can see the listener is triggering several times...
lowprofile
June 26th, 2003, 09:43 AM
Figured it out...
its ok...
lowprofile
June 26th, 2003, 09:46 AM
But I still don't know what is up with the hitTest...
kode
June 26th, 2003, 09:54 AM
if (button4.hitTest(_root._xmouse, _root._ymouse, false) || dont_close) {
??
lowprofile
June 27th, 2003, 07:47 AM
Is there a short cut to label code that is only to execute once?
It was that sometimes the movie might loop and it causes another mouse listener to be created each time so you start with one... two... three .... etc.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.