<!--链接CSS-->
<mx:Style source="styles.css" />
<!--链接AS-->
<mx:Script source="flash.as" />
<!--简单例子↓-->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Style>
TextArea {
font-size: 15px;
font-weight: bold;
}
</mx:Style>
<mx:Script>
<![CDATA[
public function close() : void {
myPanel.visible = false;
}
]]>
</mx:Script>
<mx:Fade id="myFade"/> //淡出
<mx:Panel id="myPanel" layout="absolute" width="80%" height="80%" hideEffect="{myFade}" > //hideEffect触发器
<mx:TextArea text="Say hello to Flex!" top="10" bottom="70" left="10" right="30" />
<mx:Button label="Close" right="30" bottom="40" click="close();" />
</mx:Panel>
</mx:Application>
<!--数据绑定 {} -->
<mx:TextInput id="myInput" width="150" text=""/>
<mx:TextArea id="myText" text="{myInput.text}" width="150"/>
<!--ComboBox组件应用-->
<mx:ComboBox x="20" y="20" id="cbxRating">
<mx:dataProvider>
<mx:Array>
<mx:String>Satisfied</mx:String>
<mx:String>Neutral</mx:String>
<mx:String>Dissatisfied</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
<!--***** 自定义组件(与引用) *****-->
<!--MyButton.as-->
package myControls
{
public class MyButton extends Button {
public function MyButton() {
...
}