ConfirmForm

ConfirmForm

A dialog with a short message for the user to confirm or cancel an operation.  Displayed semi-transparently.

Example

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;
        }
    }
}
Summary
ConfirmFormA dialog with a short message for the user to confirm or cancel an operation.
Private members
dialogColorBase dialog theme color
messageLabelLabel displaying a short confirmation question
Dialog creation and destruction
ConfirmFormCreate an empty confirmation dialog box.
InitializeComponentInitialize the dialog client area widgets
ShowDialogDisplays the confirmation dialog message and calls the closeHandler when the user confirms or cancels the dialog.
disposeDispose of all resources used or referenced in the instance.
Dialog event handling
acceptDialogCalled when the user accepts the dialog.
cancelDialogCalled when the user cancels the dialog.

Private members

dialogColor

private var dialogColor: uint

Base dialog theme color

messageLabel

private var messageLabel: Label

Label displaying a short confirmation question

Dialog creation and destruction

ConfirmForm

public function ConfirmForm(formColor: uint)

Create an empty confirmation dialog box.

Parameters

formColorbase theme color

InitializeComponent

public function InitializeComponent():void

Initialize the dialog client area widgets

ShowDialog

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.

Parameters

parentA sprite which becomes the parent of the dialog in the display list
confirmMessageA short question or null to use the previous or default message
closeHandlerCallback function called when the dialog is accepted or cancelled; true if accepted

Callbacks

closeHandlerfunction onConfirmFormClose(accepted:Boolean):void

dispose

public override function dispose():void

Dispose of all resources used or referenced in the instance.

Dialog event handling

acceptDialog

private function acceptDialog():void

Called when the user accepts the dialog.  Closes the dialog with true/accepted state

cancelDialog

private function cancelDialog():void

Called when the user cancels the dialog.  Closes the dialog with false/cancelled state

A base class dialog box widget.
private var dialogColor: uint
Base dialog theme color
private var messageLabel: Label
Label displaying a short confirmation question
public function ConfirmForm(formColor: uint)
Create an empty confirmation dialog box.
public function InitializeComponent():void
Initialize the dialog client area widgets
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.
public override function dispose():void
Dispose of all resources used or referenced in the instance.
private function acceptDialog():void
Called when the user accepts the dialog.
private function cancelDialog():void
Called when the user cancels the dialog.
Close