Hi,
I would like to disable Yes button in an Alert box. Is this possible?
Thanks in advance.
Hi,
I would like to disable Yes button in an Alert box. Is this possible?
Thanks in advance.
You mean disable or hide?
I don't think you can enable/disable buttons in a Alert box, but you choose which buttons will be shown, for example:
Alert.show('Text Copied!', 'Alert Box', Alert.YES | Alert.NO);
Valid buttons:
mx.controls.Alert.OK
mx.controls.Alert.YES
mx.controls.Alert.NO
mx.controls.Alert.CANCEL
Full documentation here: Alert control
If you really meant to enable/disable buttons, you could make your own MXML component based on TitleWindow
.
I would extend the Alert class with your own custom class. Add a bitmask that controls which buttons are enabled or disabled. Then override createChildren() and disable the buttons as they are created.
Try this:
import mx.core.mx_internal;
use namespace mx_internal;
private var theAlert:Alert;
public function showAlert():void
{
theAlert = Alert.show("Saving Changes...", "", Alert.YES + Alert.NO);
theAlert.mx_internal::alertForm.mx_internal::buttons[0].enabled = false;
}
public function hideAlert():void
{
PopUpManager.removePopUp(theAlert);
}