본문 바로가기

ActionScript/AS3.0

Event 클래스의 속성 target 과 currentTarget의 차이점.

container 라는 이름을 가진 무비클립안에
 
child_red chilrd_yellow 라는 이름을 가진 무비클립을 넣어두었습니다.

container 무비클립속에 두개의 무비클립이 들어있는 셈입니다.


그리고  다음과 같은 액션을 줍니다.


container.addEventListener(MouseEvent.CLICK,handler);

function handler(e:MouseEvent):void{
     currentTarget_txt.text = e.currentTarget.name;
     target_txt.text = e.target.name;
}



이벤트를 dispatch 받는 객체가 어쩌고 저쩌고 하는 내용은 제쳐두고

실제적으로 이벤트를 받는 쪽이 target

코딩상에서의 이벤트리스너를 받았던 녀석이currentTarge...
 
정도의 개념만 잡아도 어리버리 탈 일은 없을 듯 하다.

'ActionScript > AS3.0' 카테고리의 다른 글

삼각함수와 플래시 - 2. 원형회전  (0) 2008.07.07
삼각함수와 플래시 - 1.원의 좌표  (3) 2008.07.07
DisplaceMentMapFilter Class  (5) 2008.03.24
Right Click in AS3  (0) 2008.03.24
Focus selected shape  (0) 2008.03.24