ActionScript Properties
| Inheritance | MovieClip > UIObject class > GlobalMenuPro class |
Setting a property of the GlobalMenuPro class with ActionScript overrides the parameter of the same name set in the Component inspector.
Properties inherited from the UIObject class
The following table lists the properties the GlobalMenuPro class inherits from the UIObject class.
| Property |
Description |
| UIObject.left |
Read-only; the left edge of the object, in pixels. |
| UIObject.top |
Read-only; the position of the top edge of the object, relative to its parent. |
| UIObject.visible |
A Boolean value indicating whether the object is visible (true) or not (false). |
| UIObject.x |
Read-only; the left edge of the object, in pixels. |
| UIObject.y |
Read-only; the top edge of the object, in pixels. |
Properties unique to the GlobalMenuPro class
The following table lists properties of the GlobalMenuPro class.
my_menu.xmlFileURL
Property; the path to the configuration XML file. The default value is undefined.
The following example sets the xmlFileURL property to "data/top_menu.xml":
my_menu.xmlFileURL = "data/top_menu.xml";
my_menu.xml
Property (read-only); returns the XML object with the downloaded XML data.
This is the configuration XML file for a Global Menu Pro instance named "gmp". There is a custom attribute "description" in the <items> element and some <item> nodes.
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<settings>
.......................................
</settings>
<items description="Italy, officially the Italian Republic, is a country located...">
<item label="Rome">
<item label="History">
<item label="Earliest History" action="pageInformation" url="2" target="" description="There is geological evidence..."></item>
<item label="Monarchy" action="pageInformation" url="3" target="" description="Rome's early history is..."></item>
.......................................
</item>
</item>
</items>
</menu>
The code below shows how to access the attribute values looping through the XML data. Each time we click the certain menu item, the custom Flash function pageInformation is called and the text field displays the corresponding description (if included in the XML file). See also example for more information.
var country_description:String;
var desciptionArray:Array = new Array();
menuListener = new Object();
menuListener.onLoadXML = function(eventObj) {
xmlDecomposing();
}
gmp.addEventListener("onLoadXML", menuListener);
function xmlDecomposing() {
country_description = gmp.xml.firstChild.childNodes[1].attributes.description;
for (var aNode:XMLNode = gmp.xml.firstChild.childNodes[1].firstChild; aNode != null; aNode = aNode.nextSibling) {
desciptionArray.push(aNode.attributes.description);
if (aNode.hasChildNodes() == true) {
for (var bNode:XMLNode = aNode.firstChild; bNode != null; bNode = bNode.nextSibling) {
desciptionArray.push(bNode.attributes.description);
if (bNode.hasChildNodes() == true) {
for (var cNode:XMLNode = bNode.firstChild; cNode != null; cNode = cNode.nextSibling) {
desciptionArray.push(cNode.attributes.description);
}
}
}
}
}
}
function pageInformation(index:Number) {
description_textfield = desciptionArray[index];
}
|