tags:

views:

348

answers:

3

Hi, 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;
    }
}
A: 

how do you want to close your alert?

Frank
I am actually storing a reference of my alert. When another message is called, the previous gets vanish. I have updated my Question. The problem is that the previous message has an OK button which i don't want. Is there a way to remove it?
baltusaj
+1  A: 

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.

Mircea Grelus
+1  A: 

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);
}
maclema
Thanks a lot for this nice tip.
baltusaj