Flash: 익명 함수 모니터 제거 EventListener
1960 단어 listener
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);
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
JavaScript 이벤트, 프로세서, 유형 및 끝?사이트에는 각양각색의 활동이 있다.블록 지우기, 블록 압출, 이미지 읽기 완료, JSON 읽기 완료 등을 수행합니다. button 요소에서는 클릭, 클릭 등 다양한 이벤트가 발생한다.이런 사건을 일으키는 대상을'사건...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.