DialogManager
Simple dialog window manager. Version 0.3
Features:
- very simple to use;
- autosize regardless text lenght and buttons number;
- detecting stage resize and correcting background and dialog coordinates;
- posible to show text only or text with buttons;
- dialog queue;
Version History:
v 0.1
- first release
v 0.2
- small refactoring and fixes
- comments added
v 0.3
- font updated
- bug fixes
How to use:
-
Simple text:
import com.illuzor.dialog.DialogManager;
DialogManager.init(stage); // init must called one time DialogManager.addDialog("Just simple message");
-
Text with any buttons number:
import com.illuzor.dialog.DialogManager;
DialogManager.init(stage); DialogManager.addDialog("You see this message", [ {label:"OK"} ] );
// first patameter is dialog text. // second parameter is buttons array with Objects - {label:String, func:Function}; // func will called with conforming button press. // if func undefined button click just close dialog.
import com.illuzor.dialog.DialogManager;
//...
DialogManager.init(stage);
DialogManager.addDialog("Do you want to do it?", [ {label:"YES", func:yesFunction}, {label:"NO", func:noFunction} ] );
//...
private function yesFunction():void {
trace("YES pressed");
}
private function noFunction():void {
trace("NO pressed");
}
- Queue:
You can add several dialogs at the same time. Next dialog will shows only after current dialog deleting.
-
Remove current dialog manually
DialogManager.removeDialog();
-
Remove all dialogs:
DialogManager.removeAllDialogs();
-
Background parameters:
You can define background color and alpha:
DialogManager.backgroundColor = 0xFF00FF; // color uint
DialogManager.backgroundAlpha = 0.5 // Number 0-1
Roboto font developed by Google Inc. licensed under the Apache license http://www.apache.org/licenses/LICENSE-2.0 http://www.google.com/fonts/specimen/Roboto