views:

206

answers:

1

Is there a way to check the method that has been attached to the stage?

I have stage as global.. and need to fire some function in a object on mouseup... Now it fires 2 or 3 depending how many objects i add..

I need something like..

if($.stage.hasEventListener(MouseEvent.MOUSE_UP, this.mouseUp) === false){ $.stage.addEventListener(MouseEvent.MOUSE_UP, this.mouseUp); }

Or a better way to handle this?

+1  A: 

I'm guessing you are adding the listener inside each object, no? That means every time you create an instance of your object you are adding yet another listener for stage mouse up events. If you really only want a single listener for this type of event, move it outside of the scope of the object and only add the listener once. Good luck!

heavilyinvolved