Flex Alert的简单使用

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <s:layout>
        <s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>
    </s:layout>
    
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;
            protected function button1_clickHandler():void
            {
                Alert.show("显示一个对话框","提示信息");
            }
            
            protected function button2_clickHandler():void
            {
                Alert.show("你确定此操作吗?","提示信息",1|2,this,handler1);
                //点击是返回结果1,点击否返回2
            }
            
            private function handler1(e:CloseEvent):void{
                Alert.show(e.detail.toString());
            }
            
            protected function button3_clickHandler():void
            {
                Alert.yesLabel="Yes";
                Alert.noLabel="No";
                Alert.cancelLabel="Cancle";
                Alert.show("请选项","提示信息",1|2|8,this,handler2);
            }
            private function handler2(e:CloseEvent):void{
                Alert.show(e.detail.toString());
            }
            
        ]]>
    </fx:Script>
    
    <fx:Declarations>
        <!-- 将非可视元素(例如服务、值对象)放在此处 -->
    </fx:Declarations>
    <s:Button label="按钮1" click="button1_clickHandler()"/>
    <s:Button label="按钮2" click="button2_clickHandler()"/>
    <s:Button label="按钮3" click="button3_clickHandler()"/>
</s:Application>

 

posted on 2012-09-10 16:05  雷、  阅读(115)  评论(0)    收藏  举报

导航