2009-11-10 48 views
2

我可以從默認顯示的Alert.Show()消息中刪除OK按鈕嗎?Flex:從Alert.Show中刪除確定按鈕?

感謝

更新:

private var myAlert : Alert; 

public function showAlert(message: String, title : String) : void 
{ 
    hideAlert(); 

    myAlert = Alert.show(message, title); 
} 

public function hideAlert() : void 
{ 
    if(myAlert != null && myAlert.visible) { 
     myAlert.visible = false; 
    } 
} 

回答

7

這應該工作太:

import mx.core.mx_internal; 
use namespace mx_internal; 

private var theAlert:Alert; 

public function showAlert():void 
{ 
    theAlert = Alert.show("Saving Changes...", "", Alert.OK); 
    theAlert.mx_internal::alertForm.removeChild(
    theAlert.mx_internal::alertForm.mx_internal::buttons[0]); 
} 

public function hideAlert():void 
{ 
    PopUpManager.removePopUp(theAlert); 
} 
+0

非常感謝這個不錯的提示。 – baltoro 2009-12-19 20:03:38

+0

@maclema:太好了 – 2012-11-15 12:54:53

1

你不必因擁有警報沒有按鈕的選項。 您可以在「確定」,「取消」,「是」,「否」按鈕和選擇默認按鈕之間進行自定義。

如果你想要一個沒有按鈕的模態/非模態對話框,你應該創建自己的對話框。 該警報只是默認提供的快速信息/確認類的東西。

1

這是老了,但我較新的Apache的火花警報知道你可以通過0位掩碼,它不會有任何按鈕。可能會嘗試的mx警報