attributes (XMLNode.attributes property)
public attributes :
An object containing all of the attributes of the specified XML instance. The XML.attributes
object contains one variable for each attribute of the XML instance. Because these variables
are defined as part of the object, they are generally referred to as properties of the object. The
value of each attribute is stored in the corresponding property as a string. For example, if you
have an attribute named color, you would retrieve that attribute's value by specifying color as
the property name, as the following code shows:
var myColor:String = doc.firstChild.attributes.color
Availability: ActionScript 1.0; Flash Lite 2.0
Example
The following example shows the XML attribute names:
// create a tag called 'mytag' with
// an attribute called 'name' with value 'Val'
var doc:XML = new XML("<mytag name=\"Val\"> item </mytag>");
// assign the value of the 'name' attribute to variable y
var y:String = doc.firstChild.attributes.name;
trace (y); // output: Val
// create a new attribute named 'order' with value 'first'
doc.firstChild.attributes.order = "first";
// assign the value of the 'order' attribute to variable z
var z:String = doc.firstChild.attributes.order
trace(z); // output: first
The following is displayed in the Output panel:
Val
first
childNodes (XMLNode.childNodes property)
public childNodes :
An array of the specified XML object's children. Each element in the array is a reference to an
XML object that represents a child node. This is a read-only property and cannot be used to
manipulate child nodes. Use the
methods to manipulate child nodes.
This property is undefined for text nodes (
Availability: ActionScript 1.0; Flash Lite 2.0
742
ActionScript classes
Object
Array
[read-only]
appendChild()
nodeType == 3
,
, and
insertBefore()
).
removeNode()
Need help?
Do you have a question about the FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE and is the answer not in the manual?