Flash Builder 初试(一)信息提示窗口

Flash Builder的安装就不多说了,网上有很多教程,先来试一个最基本的功能,加载完成页面后,弹出“页面加载完成”提示框。

在<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" >中输入creationComplete,按ALT+/,选择"生成creationComplete处理函数",系统会自动生成代码。


import mx.events.FlexEvent;

protected
function application1_creationCompleteHandler(event:FlexEvent):void {   // TODO Auto-generated method stub
  // 这里输入的代码会在加载完成时执行
}

在application1_creationCompleteHandler中输入代码,Alert.show("页面加载完成","欢迎",Alert.OK);弹出提示框,程序会自动生成import mx.controls.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" creationComplete="application1_creationCompleteHandler(event)">
    <s:layout>
        <s:BasicLayout/>
    </s:layout>
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.FlexEvent;
            
            protected function application1_creationCompleteHandler(event:FlexEvent):void
            {
                // TODO Auto-generated method stub
                Alert.show("页面加载完成","欢迎",Alert.OK);
            }
            
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- 将非可视元素(例如服务、值对象)放在此处 -->
    </fx:Declarations>
</s:Application>

 

posted @ 2013-02-16 10:39  寂静之秋  阅读(465)  评论(0编辑  收藏  举报
哈尔滨八零网