티스토리 뷰

<?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> 

Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
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 31