<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="application1_initializeHandler(event)" creationComplete="application1_creationCompleteHandler(event)" applicationComplete="application1_applicationCompleteHandler(event)"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> </fx:Declarations> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.FlexEvent; protected function application1_initializeHandler(event:FlexEvent):void{ Alert.show("initialize"); } protected function application1_creationCompleteHandler(event:FlexEvent):void{ Alert.show("creationComplete"); } protected function application1_applicationCompleteHandler(event:FlexEvent):void{ Alert.show("applicationcomplete"); } ]]> </fx:Script> <s:Panel title="Hello, flex!" width="600" horizontalCenter="0" verticalCenter="0"> <s:Button label="Click Me" click="Alert.show('Hello flex, I am coming!', 'Hello, flex!');" horizontalCenter="0" verticalCenter="0" /> </s:Panel> </s:Application>参考: