Alert.show : YES,NO,CANCEL,OK 로 나눠서 이벤트 처리하기

컴터/Flash & Flex 2008. 9. 1. 16:47
라이브독..

<?xml version="1.0"?>
<!-- controls\alert\AlertEvent.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;

            private function alertListener(eventObj:CloseEvent):void {
                // Check to see if the OK button was pressed.
                if (eventObj.detail==Alert.OK) {
                    myText.text = myInput.text;
                }
            }
        ]]>
    </mx:Script>

    <mx:TextInput id="myInput"
        width="150"
        text="" />
    <mx:Button id="myButton"
        label="Copy Text"
        click='Alert.show("Copy Text?", "Alert",
            Alert.OK | Alert.CANCEL, this,
            alertListener, null, Alert.OK);'/>
    <mx:TextInput id="myText"/>
</mx:Application>

---------------------------------------------------------------------------

private function closeWindowAlert():void{
    Alert.show("업로드나 다운로드 중에 창을 닫으면 데이터가 삭제됩니다.\n프로그램을 종료하시겠습니까?","경고",Alert.YES|Alert.CANCEL,null,closeWindow);
   }
   
   private function closeWindow(event:CloseEvent):void
   {
   
    if(event.detail == Alert.YES){    
     this.exit();  // windows를 닫고 application을 종료
    }
    return;
   }
Trackbacks 0 : Comments 0

Write a comment