ActionScript 이벤트 처리 프로세스

function eventResponse(event:MouseEvent):void
{

// Actions performed in response to the event go here.

}



myButton.addEventListener(MouseEvent.CLICK, eventResponse);





1. Flash Player는 eventReponse()라는 함수의 존재를 기억함

2. myButton이라는 이벤트 소스 객체에서 addEventListener() 메서드를 호출하고 eventResponse 함수를 매개 변수로 전달하여 하나의 코드 행만 실행함.

3. myButton의 이벤트 리스너 목록에 eventResponse() 함수가 저장됨.

4. 사용자가 myButton 객체를 클릭한다.

5. 코드에서 MouseEvent.CLICK 이벤트가 트리거됨.

6. Flash Player는 MouseEvent와 연관된 클래스의 인스턴스인 객체를 만든다.

7. eventResponse() 함수 호출 해당 함수의 코드가 실행되어 특정 작업이 수행됨.