AlertBox With No Buttons! (HACK)

Browsing around EE today, I found an interesting question. This person wanted an AlertBox that had no buttons at all. The goal was to have the identical functionality / look as an alert, but to only display a message such as “Saving Changes…”. This is something that I do all over the place, and have written custom components specifically for locking the UI until an operation is complete.

However, if you don’t mind using some nasty hacks, this functionality can be accomplished in only a couple lines of code.

 

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

 

It’s a hack, but it works really good!

 

原文链接:http://maclema.com/b/2008/01/10/alertbox-with-no-buttons-hack/

你可能感兴趣的:(UI)