Package | Top Level |
Class | public class Preferences |
registerPreference()
. And it is
then possible to get or set their values using getValue()
and setValue()
.
If a plugin has preferences the "Options" button will be enabled in the Configuration dialog,
which will allow the user to change the preferences. It is also possible to programmatically
show this dialog box using dialogs:showPreferences()
Method | Defined by | ||
---|---|---|---|
getValue(name:String):Object
Gets the value of the given preference.
| Preferences | ||
registerPreference(preference:Array):void
Registers a preference.
| Preferences | ||
registerPreferenceGroup(name:String, title:String):void
Preferences can be grouped into tabs.
| Preferences | ||
setValue(name:String, value:Object):void
Sets the value of the given preference.
| Preferences |
getValue | () | method |
public function getValue(name:String):Object
Gets the value of the given preference.
Parametersname:String — Name of the preference
|
Object — Value of the preference
|
registerPreference | () | method |
public function registerPreference(preference:Array):void
Registers a preference. Preferences must be registered before they appear in the Preference dialog, and before their values can be accessed. A preference is an associative array, which can contain the following values:
Name | Type | Required? | Description |
---|---|---|---|
type | String | yes | Can be any of these types: Text, TextArea, Popup, CheckBox, File, Spinner, Hidden |
name | String | yes | Name of the preference. Must be unique. |
defaultValue | Any | no | Default value. |
title | String | no | Title of the preference, as displayed in the Preference dialog. |
description | String | no | Description of the preference. It is displayed below the control in the Preference dialog |
group | String | no | Optional preference group |
minValue | Number | no | Used by the Spinner control to specify the value range |
maxValue | Number | no | Used by the Spinner control to specify the value range |
secure | Boolean | no | Sets it to true to make a text field secure (eg. for password input) |
options | Array | no | Associative array of key / value pairs to specify the available options for the Popup control. |
preference:Array — Preference to register
|
-- The example below register two preferences. One text area and one checkbox preferences:registerPreference({ type = "TextArea", name = "textAreaExample", defaultValue = "Type-in some text in this boxx", title = "Text area example:" }) preferences:registerPreference({ type = "CheckBox", name = "checkboxExample", defaultValue = false, title = "Are you sure?" })
registerPreferenceGroup | () | method |
public function registerPreferenceGroup(name:String, title:String):void
Preferences can be grouped into tabs. To create a new group, use this function. you
can then assign a preference to it by using the group
property.
name:String — Name of the group
|
|
title:String — Title of the group
|
preferences:registerPreferenceGroup("advancedOptions", "Advanced")
setValue | () | method |
public function setValue(name:String, value:Object):void
Sets the value of the given preference.
Parametersname:String — Name of the preference
|
|
value:Object — New value of the preference
|