문제

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?

도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top