본문 바로가기

IT Data

[Flex3.0] 팝업창에서 부모창의 메소드 실행하기

// 부모창 

 

public function st1pop1():void{
    var st1pop1:ST1POP1 = ST1POP1(PopUpManager.createPopUp(this,ST1POP1,true));
    
    st1pop1.addEventListener("getList", function(event:ModEvent):void
    {
     getList();
    });
    
    st1pop1.getList();
    st1pop1.fnswitch(swtint);
    if (swtint == 1){
     st1pop1.fngetdata(
      dataGrid.selectedItem.exID,
      dataGrid.selectedItem.exNM,
      dataGrid.selectedItem.callingNo,
      dataGrid.selectedItem.fbNo
     );
    }
    st1pop1.cmdWindowType();
    st1pop1.width = 480;
    st1pop1.height = 250;
    PopUpManager.centerPopUp(st1pop1);
    this.swtint = 0;
  }

:: 팝업창을 실행하기 전에 addEventListenet 메소드를 부여해 주면

자식창에서 저 메소드가 실행될때, 이벤트가 발생 된다.

 

//자식창

private function regAfter(event:ResultEvent):void {
      if(event.result.toString().substr(0,1)==":"){
       try{
       this.dispatchEvent(new ModEvent("getList"));
       PopUpManager.removePopUp(this);
       }
       catch(err:Error)
       {
        Alert.show(err.toString());
       }
       Alert.show(event.result.toString(),"알림1");
      }else{
       Alert.show(event.result.toString(),"알림2");
      }

   }

::팝업창을 remove 하기 전에 부모창에서 선언해 두었던, 메소드를 실행한다.

이 구문은 팝업창에서 정보를 insert 한 이후에 부모창의 dataGrid 를 한번 더 조회하게 하는 구문이다 (최신정보로 reflash)