beautypg.com

Document.setelementproperty(), Document.setelementtextattr() – Adobe Extending Flash Professional CS4 User Manual

Page 165

background image

143

EXTENDING FLASH CS4 PROFESSIONAL

Document object

document.setElementProperty()

Availability
Flash MX 2004.

Usage

document.setElementProperty(property, value)

Parameters

property

A string that specifies the name of the

Element

property to set. For a complete list of properties and values,

see the Property summary table for the

Element object

.

You can’t use this method to set values for read-only properties, such as

element.elementType

,

element.top

, or

element.left

.

value

An integer that specifies the value to set in the specified Element property.

Returns
Nothing.

Description
Method; sets the specified

Element

property on selected object(s) in the document. This method does nothing if there

is no selection.

Example
The following example sets the width of all selected objects to 100 and the height to 50:

fl.getDocumentDOM().setElementProperty("width", 100);

fl.getDocumentDOM().setElementProperty("height", 50);

document.setElementTextAttr()

Availability
Flash MX 2004.

Usage

document.setElementTextAttr(attrName, attrValue [, startIndex [, endIndex]])

Parameters

attrName

A string that specifies the name of the

TextAttrs

property to change.

attrValue

The value to which to set the

TextAttrs

property. For a list of property names and expected values, see

the Property summary table for the

TextAttrs object

.

startIndex

An integer value that specifies the index of the first character that is affected. This parameter is optional.

endIndex

An integer value that specifies the index of the last character that is affected. This parameter is optional.