Using the Alert component

Drag an Alert component onto the Stage. Then delete it. Then put this code on the main Timeline.

  1. import mx.controls.Alert;
  2. var listenerObj:Object = new Object();
  3. listenerObj.click = function(evt) {
  4.     switch (evt.detail) {
  5.     case Alert.OK :
  6.         trace("you hit \"OK\".");
  7.         break;
  8.     case Alert.CANCEL :
  9.         trace("you hit \"CANCEL\".");
  10.         break;
  11.     }
  12. };
  13. Alert.show("ALERT! Do you want to delete the Internet?", "Error", Alert.OK | Alert.CANCEL, this, listenerObj);