티스토리 뷰
<?xml version="1.0" encoding="utf-8"?>
< mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
private var btnCancel : Button;
private function initApp():void {
btnCancel = new Button();
btnCancel.label = "Cancel";
pan.addChild(btnCancel);
btnCancel.addEventListener(MouseEvent.CLICK, btnCancelHandler);
}
private function btnCancelHandler(e:MouseEvent):void {
trace("Cancel Click" + e.target);
trace("Cancel Click" + e.currentTarget);
}
private function btnOkHandler(e:MouseEvent):void {
trace("Button Click" + e.target);
trace("Button Click" + e.currentTarget);
// 버블링 단계로 진행하지 않겠다는 명령어
e.stopPropagation();
}
private function panOkHandler(e:MouseEvent):void {
if(e.target == pan) {
trace("진짜 패널을 눌렸군요");
}
trace("Panel Click" + e.target);
trace("Panel Click" + e.currentTarget);
}
]]>
</mx:Script>
<mx:Panel id="pan" click="panOkHandler(event)">
<mx:Button id="btnOk" label="OK" click="btnOkHandler(event)"/>
</mx:Panel>
< /mx:Application>
'Language > Flex' 카테고리의 다른 글
[ Flex ][ Source ] ex08_04 : 전자랜지 (0) | 2015.11.29 |
---|---|
[ Flex ][ Source ] ex08_03 : Button Event / MouseWheel 값 event.delta (0) | 2015.11.29 |
[ Flex ][ Source ] ex08_01 : try / catch / finally (0) | 2015.11.29 |
[ Flex ][ Source ] ex06_02 : enterFrame 활용 (0) | 2015.11.29 |
[ Flex ][ Source ] ex04_02 : 클래스 정의 및 사용법 / ex06_01 : set get (0) | 2015.11.29 |