Hello all,
I’m kinda new using XML in flash, and I can’t get this to work… Everything seems to be fine, all 7 buttons have their corresponding instance, but when I hit the button already published, nothing happens, not even an error. What am I doing wrong?
This is the AS I’m using:
buttons_xml = new XML();
buttons_xml.ignoreWhite = true;
buttons_xml.onLoad = function(success) {
if (success) {
trace ('links.xml loaded successfully');
processButtons(buttons_xml);
}
};
buttons_xml.load('links.xml');
function processButtons(xmlDoc_xml) {
for (a in xmlDoc_xml.firstChild.childNodes) {
trace(a + ' ' + xmlDoc_xml.firstChild.childNodes[a]);
}
}
orders.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[0].attributes.url);
}
prices.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[1].attributes.url);
}
inventory.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[2].attributes.url);
}
clients.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[3].attributes.url);
}
reports.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[4].attributes.url);
}
settings.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[5].attributes.url);
}
profile.onRelease = function() {
getURL(this._parent.buttons_xml.firstChild.childNodes[6].attributes.url);
}
This is the XML:
<?xml version="1.0" ?>
<links>
<link url = "Orders.aspx"/>
<link url = "Prices.aspx"/>
<link url = "Products.aspx"/>
<link url = "CPUs.aspx"/>
<link url = "Reports.aspx"/>
<link url = "Parameters.aspx"/>
<link url = "Profile.aspx"/>
</links>
Trace reports:
links.xml loaded successfully
6 <link url="Profile.aspx" />
5 <link url="Parameters.aspx" />
4 <link url="Reports.aspx" />
3 <link url="CPUs.aspx" />
2 <link url="Products.aspx" />
1 <link url="Prices.aspx" />
0 <link url="Orders.aspx" />