tags:

views:

1117

answers:

5

Hi,

I would like to disable Yes button in an Alert box. Is this possible?

Thanks in advance.

A: 

See if the examples on this flex examples page help you.

Alistair Knock
+4  A: 

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.

leolobato
Thanks for your suggestion Leo. I am just trying to disable not hide.I think I have design a new Component with TitleWindow.
A: 

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.

cliff.meyers
A: 

I will suggest to you to create you own custom alert, see an example here

+1  A: 

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);
}
maclema