illuzor / DialogManager

Simple dialog window manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. Simple text:

    import com.illuzor.dialog.DialogManager;

    DialogManager.init(stage); // init must called one time DialogManager.addDialog("Just simple message");

dm_simple_text.png

  1. 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.

dm_one_button.png

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");
}

dm_two_buttons.png

dm_five_buttons.png

  1. Queue:

You can add several dialogs at the same time. Next dialog will shows only after current dialog deleting.

  1. Remove current dialog manually

    DialogManager.removeDialog();

  2. Remove all dialogs:

    DialogManager.removeAllDialogs();

  3. 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

About

Simple dialog window manager


Languages

Language:ActionScript 100.0%