Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flex: Remove OK Button from Alert.Show?

Tags:

apache-flex

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;
    }
}
like image 997
Usman Avatar asked Apr 15 '26 11:04

Usman


2 Answers

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);
}
like image 132
Matt MacLean Avatar answered Apr 22 '26 09:04

Matt MacLean


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.

like image 44
Mircea Grelus Avatar answered Apr 22 '26 08:04

Mircea Grelus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!