ConfirmForm |
A dialog with a short message for the user to confirm or cancel an operation. Displayed semi-transparently.
package { import flash.display.Sprite; import autotelicum.dialogs.ConfirmForm; import autotelicum.extras.Lorenz; public class Sample extends Sprite { private var confirmPopup:ConfirmForm = null; public function Sample() { if (confirmPopup == null) { confirmPopup = new ConfirmForm(0xAC5CCD); confirmPopup.InitializeComponent(); confirmPopup.x = 100; confirmPopup.y = 100; confirmPopup.ShowDialog(this, "Perform Lorenz attractor animation?", confirmHandler); } } private function confirmHandler(accepted:Boolean):void { if (accepted) { var lorenzAnimation:Lorenz = new Lorenz(32); addChild(lorenzAnimation); lorenzAnimation.start(10); } confirmPopup.dispose(); confirmPopup = null; } } }
ConfirmForm | A dialog with a short message for the user to confirm or cancel an operation. |
Private members | |
dialogColor | Base dialog theme color |
messageLabel | Label displaying a short confirmation question |
Dialog creation and destruction | |
ConfirmForm | Create an empty confirmation dialog box. |
InitializeComponent | Initialize the dialog client area widgets |
ShowDialog | Displays the confirmation dialog message and calls the closeHandler when the user confirms or cancels the dialog. |
dispose | Dispose of all resources used or referenced in the instance. |
Dialog event handling | |
acceptDialog | Called when the user accepts the dialog. |
cancelDialog | Called when the user cancels the dialog. |
public function ShowDialog( parent: Sprite, confirmMessage: String = null, closeHandler: Function = null ):void
Displays the confirmation dialog message and calls the closeHandler when the user confirms or cancels the dialog.
parent | A sprite which becomes the parent of the dialog in the display list |
confirmMessage | A short question or null to use the previous or default message |
closeHandler | Callback function called when the dialog is accepted or cancelled; true if accepted |
closeHandler | function onConfirmFormClose(accepted:Boolean):void |
Base dialog theme color
private var dialogColor: uint
Label displaying a short confirmation question
private var messageLabel: Label
Create an empty confirmation dialog box.
public function ConfirmForm( formColor: uint )
Initialize the dialog client area widgets
public function InitializeComponent():void
Displays the confirmation dialog message and calls the closeHandler when the user confirms or cancels the dialog.
public function ShowDialog( parent: Sprite, confirmMessage: String = null, closeHandler: Function = null ):void
Dispose of all resources used or referenced in the instance.
public override function dispose():void
Called when the user accepts the dialog.
private function acceptDialog():void
Called when the user cancels the dialog.
private function cancelDialog():void