Uthman
Uthman

Reputation: 9807

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

Upvotes: 2

Views: 3772

Answers (3)

kamcknig
kamcknig

Reputation: 925

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

Upvotes: 1

Matt MacLean
Matt MacLean

Reputation: 19648

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

Upvotes: 7

Mircea Grelus
Mircea Grelus

Reputation: 2915

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.

Upvotes: 1

Related Questions