Parameter object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

The Parameter object type is accessed from the screen.parameters array (which corresponds to the screen Property inspector in the Flash authoring tool) or by the componentInstance.parameters array (which corresponds to the component Property inspector in the authoring tool). See screen.parameters and componentInstance.parameters.

Method summary for the Parameter object

The following methods are available for the Parameter object:

Method

Description

parameter.insertItem()

Inserts an item into a list, object, or array.

parameter.removeItem()

Removes an element of the list, object, or array type of a screen or component parameter.


Property summary for the Parameter object

The following properties are available for the Parameter object:

Property

Description

parameter.category

Property; string that specifies the category property for the screen parameter or componentInstance parameter.

parameter.listIndex

An integer that specifies the value of the selected list item.

parameter.name

Read-only; a string that specifies the name of the parameter.

parameter.value

Property; corresponds to the Value field in the Parameters tab of the Component inspector, the Parameters tab of the Property inspector, or the screen Property inspector.

parameter.valueType

Read-only; a string that indicates the type of the screen or component parameter.

parameter.verbose

Specifies where the parameter is displayed.


parameter.category

Availability

Flash MX 2004.

Usage

parameter.category

Description

Property; a string that specifies the category property for the screen parameter or componentInstance parameter. This property provides an alternative way of presenting a list of parameters. This functionality is not available through the Flash user interface.

parameter.insertItem()

Availability

Flash MX 2004.

Usage

parameter.insertItem(index, name, value, type)

Parameters

index A zero-based integer index that indicates where the item will be inserted in the list, object, or array. If the index is 0, the item is inserted at the beginning of the list. If the index is greater than the list size, the new item is inserted at the end of the array.

name A string that specifies the name of the item to insert. This is a required parameter for object parameters.

value A string that specifies the value of the item to insert.

type A string that specifies the type of item to insert.

Returns

Nothing.

Description

Method; inserts an item in a list, object, or array. If a parameter is a list, object, or array, the value property is an array.

Example

The following example inserts the value of "New Value" into the labelPlacement parameter:

// Select an instance of a Button component on the Stage. var parms = fl.getDocumentDOM().selection[0].parameters; parms[2].insertItem(0, "name", "New Value", "String"); var values = parms[2].value; for(var prop in values){      fl.trace("labelPlacement parameter value = " + values[prop].value); }

parameter.listIndex

Availability

Flash MX 2004.

Usage

parameter.listIndex

Description

Property; the value of the selected list item. This property is valid only if the valueType parameter is "List".

Example

The following example sets the first parameter for a Slide, which is the autoKeyNav parameter. To set the parameter to one of its acceptable values (TRue, false, or inherit) parameter.listIndex is set to the index of the item in the list (0 for true, 1 for false, 2 for inherit).

var parms = fl.getDocumentDOM().screenOutline.screens[1].parameters; parms[0].listIndex = 1;

parameter.name

Availability

Flash MX 2004.

Usage

parameter.name

Description

Read-only property; a string that specifies the name of the parameter.

Example

The following example shows the name of the fifth parameter for the selected component:

var parms = fl.getDocumentDOM().selection[0].parameters; fl.trace("name: " + parms[4].name);

The following example shows the name of the fifth parameter for the specified screen:

var parms = fl.getDocumentDOM().screenOutline.screens[1].parameters;   fl.trace("name: " + parms[4].name);

parameter.removeItem()

Availability

Flash MX 2004.

Usage

parameter.removeItem(index)

Parameters

index The zero-based integer index of the item to remove from the screen or component property.

Returns

Nothing.

Description

Method; removes an element of the list, object, or array type of a screen or component parameter.

Example

The following example removes the element at index 1 from the labelPlacement parameter of a component:

// Select an instance of a Button component on the Stage. var parms = fl.getDocumentDOM().selection[0].parameters; var values = parms[2].value; fl.trace("--Original--"); for(var prop in values){   fl.trace("labelPlacement value = " + values[prop].value); } parms[2].removeItem(1); var newValues = parms[2].value; fl.trace("--After Removing Item--"); for(var prop in newValues){   fl.trace("labelPlacement value = " + newValues[prop].value); }

The following example removes the element at index 1 from the autoKeyNav parameter of a screen:

// Open a presentation document. var parms = fl.getDocumentDOM().screenOutline.screens[1].parameters; var values = parms[0].value; fl.trace("--Original--"); for(var prop in values){   fl.trace("autoKeyNav value = " + values[prop].value); } parms[0].removeItem(1); var newValues = parms[0].value; fl.trace("--After Removing Item--"); for(var prop in newValues){   fl.trace("autoKeyNav value = " + newValues[prop].value); }

parameter.value

Availability

Flash MX 2004.

Usage

parameter.value

Description

Property; corresponds to the Value field in the Parameters tab of the Component inspector, the Parameters tab of the Property inspector, or the screen Property inspector. The type of the value property is determined by the valueType property for the parameter (see parameter.valueType).

parameter.valueType

Availability

Flash MX 2004.

Usage

parameter.valueType

Description

Read-only property; a string that indicates the type of the screen or component parameter. The type can be one of the following values: "Default", "Array", "Object", "List", "String", "Number", "Boolean", "Font Name", "Color", "Collection", "Web Service URL", or "Web Service Operation".

See also

parameter.value

parameter.verbose

Availability

Flash MX 2004.

Usage

parameter.verbose

Description

Property; specifies where the parameter is displayed. If the value of this property is 0 (nonverbose), the parameter is displayed only in the Component inspector. If it is 1 (verbose), the parameter is displayed in the Component inspector and in the Parameters tab of the Property inspector.

     < 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