2009-11-10 135 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警报