码迷,mamicode.com
首页 > 其他好文 > 详细

Flash:移除匿名函数监听器EventListener

时间:2014-07-06 18:48:37      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   strong   cti   io   

            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);
                    }
                }
            }

 

Flash:移除匿名函数监听器EventListener,布布扣,bubuko.com

Flash:移除匿名函数监听器EventListener

标签:style   blog   color   strong   cti   io   

原文地址:http://www.cnblogs.com/kenkofox/p/3824996.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!