MX: listener trips multiple times

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?

some code would help

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…

Figured it out…

its ok…

But I still don’t know what is up with the hitTest…

if (button4.hitTest(_root._xmouse, _root._ymouse, false) || dont_close) {

??

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.