Flex Alert Sample

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:TextArea x="10" y="32" width="436" height="253" id="t1"/>
<mx:Button x="145" y="306" label="Click" width="166" height="42" id="btn" click="alertDemo(event);"/>
<mx:Label x="10" y="6" text="验证Alert的用法:" width="226" id="l1" fontFamily="宋体" fontSize="16" color="#06D274" fontWeight="bold"/>
<mx:Script>
   <![CDATA[
    import mx.events.CloseEvent;
    import mx.controls.Alert;
    import flash.events.MouseEvent;
    private function alertDemo(evt:MouseEvent):void{
   
     Alert.okLabel="确定";
     Alert.cancelLabel="取消";
     Alert.show("你真的要删除吗?删除将不能回复!","删除确认",Alert.OK|Alert.CANCEL,this,myClick,null,Alert.CANCEL);
        
     }
      private function myClick(evt:CloseEvent):void{
      if(evt.detail==Alert.OK){
         t1.text+= getTimer() + ":你点了确认按钮\n";
      }
      if(evt.detail==Alert.CANCEL){
         t1.text+= getTimer() + ":你点了取消按钮\n";
      }
      } 
  
   ]]>
</mx:Script>
<mx:Style>
      Alert{
           messageStyleName:alertMessage;
           titleStyleName:alertTitle;
           buttonStyleName:alertButton;
      }
   .alertMessage{
    fontSize:12px;
    fontFamily:宋体;
    color:#06D274;
    fontWeight:bold;
   }
   .alertTitle{
    fontSize:16px;
    fontFamily:宋体;
    color:#FF0000;
   }
   .alertButton{
    fontSize:16px;
    color:#f10c58;
    /*fontFamily:宋体;*/
   }
</mx:Style>
</mx:Application>

摘自 http://vipoyb.javaeye.com/blog/394689
posted @ 2009-08-20 10:29  伊莱克斯  阅读(1377)  评论(1编辑  收藏  举报