| Package | qnx.dialog |
| Class | public final class AlertDialog |
| Inheritance | AlertDialog BaseDialog flash.events.EventDispatcher |
AlertDialog class encapsulates the properties of
an alert dialog, which is used to display system-level or application-level alerts to the user.
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | align : String [write-only]
Sets the position of the dialog. | BaseDialog | |
![]() | defaultButtonIndex : int
Gets or sets the default button index value. | BaseDialog | |
![]() | dialogSize : String
Gets or sets the size of the dialog. | BaseDialog | |
![]() | hideOnButtonClick : Boolean
Gets or sets the a value that determines if the dialog will close
when the user clicks a button. | BaseDialog | |
![]() | hideOnOutsideClick : Boolean
Gets or sets the a value that determines if the dialog will close
when the user clicks outside the dialog ( perhaps on the modal ). | BaseDialog | |
![]() | id : String
The ID of the dialog, where each ID is unique to the client owner. | BaseDialog | |
| message : String [write-only]
Sets the value of the message field. | AlertDialog | ||
| messageHtml : String [write-only]
Sets the message TextField's html value. | AlertDialog | ||
![]() | modalAlpha : Number [write-only]
Sets the background alpha value. | BaseDialog | |
![]() | selectedIndex : int [read-only]
Returns the selected index of the button (that was clicked). | BaseDialog | |
![]() | title : String [write-only]
Sets the text for the dialog's title. | BaseDialog | |
![]() | titleHtml : String [write-only]
Sets the html text for the dialog's title. | BaseDialog | |
| Method | Defined By | ||
|---|---|---|---|
Constructor for the AlertDialog class. | AlertDialog | ||
![]() | addButton(label:String):int
Adds a button to the dialog. | BaseDialog | |
![]() | cancel():void
Cancels or hides the dialog. | BaseDialog | |
![]() | getButtonCount():int
Return the button count from the button array. | BaseDialog | |
![]() | getButtonPropertyAt(prop:String, index:int):Object
Gets the value of a property, given the property name and property object index. | BaseDialog | |
![]() | getItemAt(index:int):Object
Returns the button at the given index. | BaseDialog | |
![]() | removeButtonAt(index:int):void
Removes a button from the dialog, given an index. | BaseDialog | |
![]() | sendDescription():Object
Gathers up and returns the description object for the dialog (client side). | BaseDialog | |
![]() | setButtonPropertyAt(prop:String, value:Object, index:int):void
Sets a button property given a property name, a property value, and the index of a button property object. | BaseDialog | |
![]() | show(groupId:String = null):void
Shows the dialog on the screen as a system or application dialog. | BaseDialog | |
![]() | update():void
Updates the dialog to reflect its current attributes. | BaseDialog | |
| message | property |
message:String [write-only] Sets the value of the message field.
public function set message(value:String):voidSee also
| messageHtml | property |
messageHtml:String [write-only]
Sets the message TextField's html value.
In addition to providing HTML formatting to message text, the messageHtml method can be used to place
images from the web within the message body of a dialog. In the following listing, an external image is placed in the
body of a dialog and scaled using the width and height attributes:
var dialog:AlertDialog = new AlertDialog();
dialog.messageHtml = "<img src='http://www.somewebsite.com/somegraphic.jpg'" +
"width='500' height='350'/>";
public function set messageHtml(value:String):void| AlertDialog | () | Constructor |
public function AlertDialog()
Constructor for the AlertDialog class.
The following listing shows an AlertDialog instance, called
alert, that displays a message along with OK and CANCEL buttons.
It traces the result of a button press including the button location and text on the button:
private function showAlertDialog():void
{
alert = new AlertDialog();
alert.title = "Warning";
alert.message = "This operation may harm your computer. Do you still want to proceed?";
alert.addButton("OK");
alert.addButton("CANCEL");
alert.dialogSize= DialogSize.SIZE_MEDIUM;
alert.addEventListener(Event.SELECT, alertButtonClicked);
alert.show(IowWindow.getAirWindow().group);
}
private function alertButtonClicked(event:Event):void
{
trace("Button Clicked Index: " + event.target.selectedIndex);
trace("Button properties Object"+event.target.getItemAt(event.target.selectedIndex);
}
The code snippet above produces the following dialog: