일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- 파싱
- 아두이노 기초강좌
- 아두이노 강좌
- 챗지피티
- Python
- HTML
- 쿠팡파트너스
- 무료일러스트
- 아두이노
- ChatGPT
- 자동포스팅
- vps
- cocos2d-x
- php
- Javascript
- 가상서버
- Ajax
- 자동글쓰기
- 워드프레스
- 프로그램
- flex
- c#
- 자바스크립트
- 자동블로그
- 웹
- vultr
- 아두이노 초보
- 그누보드
- Php공부
- 파이썬
Archives
- Today
- Total
플밍
target 과 currentTarget 본문
target 은 이벤트를 발생시킨 대상 (이벤트를 dispatch 시킨 놈)이고
currentTarget 은 이벤트 청취자이자다.
아래 소스를 실행해보면 긴말 필요없이 이해 될듯...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()"
verticalScrollPolicy="off" horizontalScrollPolicy="off" width="341" height="422">
<mx:Script>
<![CDATA[
private function init():void{
c1.addEventListener(MouseEvent.CLICK, viewResult);
}
private function viewResult(event:MouseEvent):void{
txtTarget.text = event.target.id;
txtCurrent.text = event.currentTarget.id;
}
]]>
</mx:Script>
<mx:VBox id="c1" width="285" height="303" backgroundColor="#F61111">
<mx:VBox id="c2" width="195" height="166" backgroundColor="#8900FE" label="c2">
<mx:Label text="c2" fontSize="20"/>
</mx:VBox>
<mx:Label text="c1" fontSize="20"/>
</mx:VBox>
<mx:HBox width="289" height="29">
<mx:Label text="target "/>
<mx:TextInput id="txtTarget"/>
</mx:HBox>
<mx:HBox width="289" height="34">
<mx:Label text="currentTarget"/>
<mx:TextInput id="txtCurrent"/>
</mx:HBox>
</mx:Application>
currentTarget 은 이벤트 청취자이자다.
아래 소스를 실행해보면 긴말 필요없이 이해 될듯...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()"
verticalScrollPolicy="off" horizontalScrollPolicy="off" width="341" height="422">
<mx:Script>
<![CDATA[
private function init():void{
c1.addEventListener(MouseEvent.CLICK, viewResult);
}
private function viewResult(event:MouseEvent):void{
txtTarget.text = event.target.id;
txtCurrent.text = event.currentTarget.id;
}
]]>
</mx:Script>
<mx:VBox id="c1" width="285" height="303" backgroundColor="#F61111">
<mx:VBox id="c2" width="195" height="166" backgroundColor="#8900FE" label="c2">
<mx:Label text="c2" fontSize="20"/>
</mx:VBox>
<mx:Label text="c1" fontSize="20"/>
</mx:VBox>
<mx:HBox width="289" height="29">
<mx:Label text="target "/>
<mx:TextInput id="txtTarget"/>
</mx:HBox>
<mx:HBox width="289" height="34">
<mx:Label text="currentTarget"/>
<mx:TextInput id="txtCurrent"/>
</mx:HBox>
</mx:Application>
Comments