Class: tinyMCEPopup

# tinyMCEPopup

Class | tinyMCEPopup
Type | Singleton

TinyMCE popup/dialog helper class. This gives you easy access to the parent editor instance and a bunch of other things. It's higly recommended that you load this script into your dialogs.

## Public Methods

Method | Defined By
--- | ---
alert(t:String, cb:function, s:Object):void [static] Creates a alert dialog. | tinyMCEPopup
close():void [static] Closes the current window. | tinyMCEPopup
confirm(t:String, cb:function, s:Object):void [static] Creates a confirm dialog. | tinyMCEPopup
execCommand(cmd:String, ui:Boolean, val:Object, a:Object):void [static] Executed a command on editor that opened the dialog/popup. | tinyMCEPopup
executeOnLoad(s:String):void [static] Will executed the specified string when the page has been loaded. | tinyMCEPopup
getLang(n:String, dv:String):String [static] Returns a language item by key. | tinyMCEPopup
getParam(n:String, dv:String):String [static] Returns a editor parameter/config option value. | tinyMCEPopup
getWin():Window [static] Returns the reference to the parent window that opened the dialog. | tinyMCEPopup
getWindowArg(n:String, dv:String):String [static] Returns a window argument/parameter by name. | tinyMCEPopup
init():void [static] Initializes the popup this will be called automatically. | tinyMCEPopup
openBrowser(element_id:string, type:string, option:string):void [static] Opens a filebrowser/imagebrowser this will set the output value from the browser as a value on the specified element. | tinyMCEPopup
pickColor(e:DOMEvent, element_id:string):void [static] Executes a color picker on the specified element id. | tinyMCEPopup
requireLangPack():void [static] Loads a specific dialog language pack. | tinyMCEPopup
resizeToInnerSize():void [static] Resizes the dialog to the inner size of the window. | tinyMCEPopup
restoreSelection():void [static] Restores any stored selection. | tinyMCEPopup
storeSelection():void [static] Stores the current editor selection for later restoration. | tinyMCEPopup

## Method details

### alertmethod

`public static function alert(t:String, cb:function, s:Object):void`
Creates a alert dialog. Please don't use the blocking behavior of this native version use the callback method instead then it can be extended.

#### Parameters

t:String | Title for the new alert dialog.
cb:function | Callback function to be executed after the user has selected ok.
s:Object | Optional scope to execute the callback in.

### closemethod

`public static function close():void`
Closes the current window.

### confirmmethod

`public static function confirm(t:String, cb:function, s:Object):void`
Creates a confirm dialog. Please don't use the blocking behavior of this native version use the callback method instead then it can be extended.

#### Parameters

t:String | Title for the new confirm dialog.
cb:function | Callback function to be executed after the user has selected ok or cancel.
s:Object | Optional scope to execute the callback in.

### execCommandmethod

`public static function execCommand(cmd:String, ui:Boolean, val:Object, a:Object):void`
Executed a command on editor that opened the dialog/popup.

#### Parameters

cmd:String | Command to execute.
ui:Boolean | Optional boolean value if the UI for the command should be presented or not.
val:Object | Optional value to pass with the comman like an URL.
a:Object | Optional arguments object.

### executeOnLoadmethod

`public static function executeOnLoad(s:String):void`
Will executed the specified string when the page has been loaded. This function was added for compatibility with the 2.x branch.

#### Parameters

s:String | String to evalutate on init.

### getLangmethod

`public static function getLang(n:String, dv:String):String`
Returns a language item by key.

#### Parameters

n:String | Language item like mydialog.something.
dv:String | Optional default value to return.

#### Returns

String - Language value for the item like "my string" or the default value if it wasn't found.

### getParammethod

`public static function getParam(n:String, dv:String):String`
Returns a editor parameter/config option value.

#### Parameters

n:String | Name of the editor config option to retrive.
dv:String | Optional default value to return.

#### Returns

String - Parameter value or default value if it wasn't found.

### getWinmethod

`public static function getWin():Window`
Returns the reference to the parent window that opened the dialog.

#### Returns

Window - Reference to the parent window that opened the dialog.

### getWindowArgmethod

`public static function getWindowArg(n:String, dv:String):String`
Returns a window argument/parameter by name.

#### Parameters

n:String | Name of the window argument to retrive.
dv:String | Optional default value to return.

#### Returns

String - Argument value or default value if it wasn't found.

### initmethod

`public static function init():void`
Initializes the popup this will be called automatically.

### openBrowsermethod

`public static function openBrowser(element_id:string, type:string, option:string):void`
Opens a filebrowser/imagebrowser this will set the output value from the browser as a value on the specified element.

#### Parameters

element_id:string | Id of the element to set value in.
type:string | Type of browser to open image/file/flash.
option:string | Option name to get the file_broswer_callback function name from.

### pickColormethod

`public static function pickColor(e:DOMEvent, element_id:string):void`
Executes a color picker on the specified element id. When the user then selects a color it will be set as the value of the specified element.

#### Parameters

e:DOMEvent | DOM event object.
element_id:string | Element id to be filled with the color value from the picker.

### requireLangPackmethod

`public static function requireLangPack():void`
Loads a specific dialog language pack. If you pass in plugin_url as a arugment when you open the window it will load the /langs/`_dlg.js lang pack file.`

### resizeToInnerSizemethod

`public static function resizeToInnerSize():void`
Resizes the dialog to the inner size of the window. This is needed since various browsers have different border sizes on windows.

### restoreSelectionmethod

`public static function restoreSelection():void`
Restores any stored selection. This can be useful since some browsers looses it's selection if a control element is selected/focused inside the dialogs.

### storeSelectionmethod

`public static function storeSelection():void`
Stores the current editor selection for later restoration. This can be useful since some browsers looses it's selection if a control element is selected/focused inside the dialogs.