private function handleCreationComplete():void {
                sampleButton.addEventListener(MouseEvent.CLICK, createClickListener(1));
                sampleButton.addEventListener(MouseEvent.CLICK, createClickListener(2));
            }
            
            private function createClickListener(clickLimit:int):Function {
                var clickCount:int = 0;
                return function(mouseEvent:MouseEvent):void {
                    clickCount++;
                    trace("Click limit", clickLimit, "registering click", clickCount);
                    if (clickCount >= clickLimit) {
                        trace("Click limit", clickLimit, "no longer listening");
                        mouseEvent.target.removeEventListener(MouseEvent.CLICK, arguments.callee);
                    }
                }
            }

 

相关文章:

  • 2021-05-28
  • 2021-06-22
  • 2021-08-19
猜你喜欢
  • 2021-08-16
  • 2022-01-21
  • 2021-07-06
  • 2023-03-16
  • 2021-11-09
  • 2022-12-23
  • 2021-09-13
相关资源
相似解决方案