XMLUI object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

Flash 8 supports custom dialog boxes written in a subset of the XML User Interface Language (XUL). An XML User Interface (XMLUI) dialog box can be used by several Flash features, such as commands and behaviors, to provide a user interface for features that you build using extensibility. The XMLUI object provides the ability to get and set properties of an XMLUI dialog box, and accept or cancel out of one. The XMLUI methods can be used in callbacks, such as oncommand handlers in buttons.

You can write a dialog.xml file and invoke it from the JavaScript API using the document.xmlPanel() method. To retrieve an object representing the current XMLUI dialog box, use fl.xmlui.

For more information, see Appendix B, "XML to UI" in Using Flash in Flash Help.

Method summary for the XMLUI object

The following methods are available for the XMLUI object:

Method

Description

xmlui.accept()

Closes the current XMLUI dialog box with an accept state.

xmlui.cancel()

Closes the current XMLUI dialog box exit with a cancel state.

xmlui.get()

Retrieves the value of the specified property of the current XMLUI dialog box.

xmlui.getControlItemElement()

Returns the current control item for the specified control.

xmlui.getEnabled()

Returns a Boolean value that specifies whether the control is enabled or disabled (dimmed).

xmlui.getVisible()

Returns a Boolean value that specifies whether the control is visible or hidden.

xmlui.set()

Modifies the value of the specified property of the current XMLUI dialog box.

xmlui.setControlItemElement()

Sets the label and value for the current item.

xmlui.setControlItemElements()

Sets the label, value pairs of the current item.

xmlui.setEnabled()

Enables or disables (dims) a control.

xmlui.setVisible()

Shows or hides a control.


xmlui.accept()

Availability

Flash MX 2004.

Usage

xmlui.accept()

Parameters

None.

Returns

Nothing.

Description

Method; closes the current XMLUI dialog box with an accept state, which is equivalent to the user clicking the OK button.

See also

fl.xmlui, document.xmlPanel(), xmlui.cancel()

xmlui.cancel()

Availability

Flash MX 2004.

Usage

xmlui.cancel()

Parameters

None.

Returns

Nothing.

Description

Method; closes the current XMLUI dialog box with a cancel state, which is equivalent to the user clicking the Cancel button.

See also

fl.xmlui, document.xmlPanel(), xmlui.accept()

xmlui.get()

Availability

Flash MX 2004.

Usage

xmlui.get( controlPropertyName )

Parameters

controlPropertyName A string that specifies the name of the XMLUI property whose value you want to retrieve.

Returns

A string that represents the value of the specified property. In cases where you might expect a Boolean value of true or false, it returns the string "true" or "false".

Description

Method; retrieves the value of the specified property of the current XMLUI dialog box.

Example

The following example returns the value of a property named "URL":

fl.xmlui.get("URL");

See also

fl.xmlui, document.xmlPanel(), xmlui.getControlItemElement(), xmlui.set()

xmlui.getControlItemElement()

Availability

Flash 8.

Usage

xmlui.getControlItemElement( controlPropertyName )

Parameters

controlPropertyName A string that specifies the property whose control item element you want to retrieve.

Returns

An object that represents the current control item for the control specified by controlPropertyName.

Description

Method; returns the label and value of the line selected in a ListBox or ComboBox control for the control specified by controlPropertyName.

Example

The following example returns the label and value of the currently selected line for the myListBox control :

var elem = new Object(); elem = fl.xmlui.getControlItemElement("myListBox"); fl.trace("label = " + elem.label + " value = " + elem.value);

See also

fl.xmlui, document.xmlPanel(), xmlui.get(), xmlui.setControlItemElement(), xmlui.setControlItemElements()

xmlui.getEnabled()

Availability

Flash 8.

Usage

xmlui.getEnabled( controlID )

Parameters

controlID A string that specifies the ID attribute of the control whose status you want to retrieve.

Returns

A Boolean value of TRue if the control is enabled; false otherwise.

Description

Method; returns a Boolean value that specifies whether the control is enabled or disabled (dimmed).

Example

The following example returns a value that indicates whether the control with the ID attribute myListBox is enabled:

var isEnabled = fl.xmlui.getEnabled("myListBox"); fl.trace(isEnabled);

See also

fl.xmlui, document.xmlPanel(), xmlui.setEnabled()

xmlui.getVisible()

Availability

Flash 8.

Usage

xmlui.getVisible(controlID)

Parameters

controlID A string that specifies the ID attribute of the control whose visibility status you want to retrieve.

Returns

A Boolean value of true if the control is visible, or false if it is invisible (hidden).

Description

Method; returns a Boolean value that specifies whether the control is visible or hidden.

Example

The following example returns a value that indicates whether the control with the ID attribute myListBox is visible:

var isVisible = fl.xmlui.getVisible("myListBox"); fl.trace(isVisible);

See also

xmlui.setVisible()

xmlui.set()

Availability

Flash MX 2004.

Usage

xmlui.set( controlPropertyName, value )

Parameters

controlPropertyName A string that specifies the name of XMLUI property to modify.

value A string that specifies the value to which you want to set the XMLUI property.

Returns

Nothing.

Description

Method; modifies the value of the specified property of the current XMLUI dialog box.

Example

The following example sets the value of a property named "URL" to "www.macromedia.com":

fl.xmlui.set("URL", "www.macromedia.com");

See also

fl.xmlui, document.xmlPanel(), xmlui.get(), xmlui.setControlItemElement(), xmlui.setControlItemElements()

xmlui.setControlItemElement()

Availability

Flash 8.

Usage

xmlui.setControlItemElement( controlPropertyName, elementItem )

Parameters

controlPropertyName A string that specifies the control item element to set.

elementItem A JavaScript object with a string property named label and an optional string property named value. If the value property does not exist, then it is created and assigned the same value as label.

Returns

Nothing.

Description

Method; sets the label and value of the currently selected line in the ListBox or ComboBox control specified by controlPropertyName.

Example

The following example sets the label and value for the current item of the control property named "PhoneNumber":

var elem = new Object(); elem.label = "Fax"; elem.value = "707-555-5555"; fl.xmlui.setControlItemElement("PhoneNumber",elem);

See also

fl.xmlui, document.xmlPanel(), xmlui.getControlItemElement(), xmlui.set(), xmlui.setControlItemElements()

xmlui.setControlItemElements()

Availability

Flash 8.

Usage

xmlui.setControlItemElements( controlID, elementItemArray )

Parameters

controlID A string that specifies the ID attribute of the control you want to set.

elementItemArray An array of JavaScript objects, where each object has a string property named label and an optional string property named value. If the value property does not exist, then it is created and assigned the same value as label.

Returns

Nothing.

Description

Method; clears the values of the ListBox or ComboBox control specified by controlID and replaces the list or menu items with the label, value pairs specified by elementItemArray.

Example

The following example sets the label and value of items in the the control with the ID attribute myControlID to the label, value pairs specified:

var nameArray = new Array("January", "February", "March"); var monthArray = new Array(); for (i=0;i<nameArray.length;i++){   elem = new Object();   elem.label = nameArray[i];   elem.value = i;   monthArray[i] = elem; } fl.xmlui.setControlItemElements("myControlID", monthArray);

See also

xmlui.getControlItemElement(), xmlui.set(), xmlui.setControlItemElement()

xmlui.setEnabled()

Availability

Flash 8.

Usage

xmlui.setEnabled( controlID, enable )

Parameters

controlID A string that specifies the ID attribute of the control you want to enable or disable.

enable A Boolean value of true if you want to enable the control, or false if you want to disable (dim) it.

Returns

Nothing.

Description

Method; enables or disables (dims) a control.

Example

The following example dims the control with the ID attribute myControl:

fl.xmlui.setEnabled("myControl", false);

See also

xmlui.getEnabled()

xmlui.setVisible()

Availability

Flash 8.

Usage

xmlui.setVisible(controlID, visible)

Parameters

controlID A string that specifies the ID attribute of the control you want to show or hide.

visible A Boolean value of true if you want to show the control; false if you want to hide it.

Returns

Nothing.

Description

Method; shows or hides a control.

Example

The following example hides the control with the ID attribute myControl:

fl.xmlui.setVisible("myControl", false);

See also

xmlui.getVisible()

     < Day Day Up > 


    Developing Extensions for Macromedia Flash 8
    Developing Extensions for Macromedia Flash 8
    ISBN: 032139416X
    EAN: 2147483647
    Year: 2005
    Pages: 81

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net