Flex: Remove OK Button from Alert.Show?
Can i remove the OK Button from Alert.Show() message which displays by default?
Thanks
Update:
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;
}
}
This should work too:
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);
}
You don't have an option for having no buttons on the Alert. You can customize between having Ok, Cancel, Yes, No buttons and choosing a default button.
You should create your own dialog box if you want a modal/non-modal dialog with no buttons. The Alert is just something default provided for quick info/confirmations kind of things.
It's old, but I know with the newer Apache spark Alert you can just pass 0 for the bitmask and it won't have any buttons. Might try that for the mx Alert
精彩评论