為了元件更完善的發揮,Flex提供了許多進階特性和功能。比如工具提示,視窗彈出,元素拖拽,自定義清單元素,以及指針,焦點的管理和鍵盤的控制....
工具提示
添加工具提示

< mx:Button id ="button" label ="Tool Tip Example" toolTip ="Display Tool Tip" />
工具提示可綁定動态資料。

< mx:VBox >

< mx:Button id ="button" label ="Button" toolTip ="{textInput.text}" />

< mx:TextInput id ="textInput" />

</ mx:VBox >
嵌套的工具提示,層級越深,優先級越高。如果無提示内容,則顯示上層的提示。

< mx:VBox toolTip ="This is the VBox tool tip." >

< mx:Button id ="button" label ="Button" toolTip ="This is the button tool tip." />

< mx:TextInput id ="textInput" />

</ mx:VBox >
但這條規則在導航類元件時有點不同。導航類的元件,導覽列和内在元素的提示是沒有聯系的。
如下例子,在Accordion中的兩個VBox的提示,隻顯示于導覽列。

< mx:Accordion toolTip ="Accordion" width ="200" height ="200" >

< mx:VBox toolTip ="vbox 1" >

< mx:HBox toolTip ="vbox.hbox" >

< mx:Button />

< mx:Button toolTip ="vbox.hbox.button" />

</ mx:HBox >

</ mx:VBox >

< mx:VBox toolTip ="vbox 2" >

< mx:Button />

< mx:Button toolTip ="vbox.button" />

</ mx:VBox >

</ mx:Accordion >
如果要手動換行提示内容,在AS中可以加入 /n/r/f這類轉義字元,在MXML中用 (注意末尾的分号)
修改提示樣式
設定提示框的最大寬度,預設為300
mx.controls.ToolTip.maxWidth = 300;
加入自定義字型。
<mx:Style>
@font-face {
src: local("Georgia");
fontFamily: GeorgiaEmbedded;
}
ToolTip {
fontFamily: GeorgiaEmbedded;
backgroundColor: #FFFFFF;
}
</mx:Style>
激活/屏蔽工具提示,預設為激活
mx.managers.ToolTipManager.enabled = true/false;
滑鼠移上後,提示出現的等待時間,預設為500毫秒
mx.managers.ToolTipManager.showDelay = 500;
滑鼠滞留中,提示消失的等待時間,預設為10秒
mx.managers.ToolTipManager.hideDelay = 10000;
滑鼠滞留中,提示永不消失。
mx.managers.ToolTipManager.hideDelay = Infinity;
提示消失前,滑鼠移動至下一個元素(無須等待,直接顯示其提示)的時間間隔,預設為100毫秒
mx.managers.ToolTipManager.scrubDelay = 100;
自制提示執行個體。必須實作mx.core.IToolTip。
mx.managers.ToolTipManager.toolTipClass = CustomClass;