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


                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);
                        }
                    }
                }
  • 相关阅读:
    DOM基本介绍
    BOM的基本介绍
    对象
    函数
    时钟
    双色球
    JS数据结构
    微信扫二维码根据系统下载apk
    javascript相关积累
    ajax精华
  • 原文地址:https://www.cnblogs.com/kenkofox/p/3824996.html
Copyright © 2020-2023  润新知