Hi there
I am loading an xml file using AS2.0. On Mac, all the elements load completely, but as soon as I run it on Windows, only the first element of type item
loads. When I run it on Mac, the elements are loaded in and all item
's are separate buttons. When I run it on Windows, only one button appears and its name is ch1. Virgin Group Holdings. None of the other item
elements load. I don't have a Windows versions of Flash to work on, so I cannot debug.
Is there another way to determine if this has to do with the XML file loading incompletely or with the depths of the Movieclips? Here is the URL
Here is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<item link="vgh" name="ch1. Virgin Group Holdings" movie="VirleoGH">
<menuitem link="vgh_overview">Group Overview</menuitem>
<menuitem link="vgh_capacity">Group Capacity</menuitem>
<menuitem link="vgh_archive">Certification Archive</menuitem>
<menuitem link="vgh_timeline">Timeline</menuitem>
</item>
<item link="mdb" name="ch2. Manny Design Bureau" movie="MechanologyDB">
<menuitem link="mdb_overview">Overview</menuitem>
<menuitem link="mdb_archive">Works Archive</menuitem>
<menuitem link="mdb_showroom">Showroom</menuitem>
<menuitem link="mdb_skills">Core Skills</menuitem>
<menuitem link="mdb_products">Products</menuitem>
</item>
<item link="sai" name="ch3. Special Autonomic Industries" movie="SpecialAI">
<menuitem link="sai_overview">Overview</menuitem>
<menuitem link="sai_archive">Works Archive</menuitem>
<menuitem link="sai_showroom">Showroom</menuitem>
<menuitem link="sai_skills">Core Skills & Serices</menuitem>
<menuitem link="sai_products">Products</menuitem>
<menuitem link="sai_infrastructure">Infrastructure</menuitem>
</item>
<item link="iacs" name="ch4. Interesting And Cool Stuff"></item>
</menu>
And here is the code where I load the XML file:
var xmlFile:String = "menu.xml";
var menu:XML = new XML();
// ignores spaces and declaration in XML file, improves parsing of XML file
menu.ignoreWhite = true;
// create 'mainMenu' (type Menu), holds all functions related to menu and constructs array from XML
var mainMenu:Menu = new Menu();
// event handler triggerred when XML is completely loaded
menu.onLoad = function(success:Boolean) {
if (success) {
// passes XML file to buildMenu function in Menu class to build menu Array
mainMenu.buildMenu(this);
// passes 'mainMenu' (type Menu) to buildScene function, builds whole scene with individual MC's
buildScene(mainMenu);
// set depth of navigation to top of pile, in order for buttons to move behind the navigation, instead of on top of it
_root.navigation.swapDepths(theScene);
}
}
// load XML file
menu.load(xmlFile);
Does somebody mind giving me pointers on pitfalls that I missed?
Regards & TIA
// EDIT src for buildMenu() function
// build multi-dimensional array from XML file received
function buildMenu(menu:XML):Void {
// determine how many chambers there are now
menuArray = menu.firstChild.childNodes;
var length:Number = menuArray.length;
// dynamic according to number of chambers
for (var i:Number = 0; i < length; i++) {
var sublength:Number = menuArray[i].childNodes.length;
var submenu:Array = new Array();
// chamber name and link
var xmlNode:XMLNode = menuArray[i];
submenu["name"] = xmlNode.attributes.name;
submenu["link"] = xmlNode.attributes.link;
submenu["movie"] = xmlNode.attributes.movie;
trace(submenu["name"]);
// create sub-item for each chamber
for (var j:Number = 0; j < sublength; j++) {
var subXmlNode:XMLNode = xmlNode.childNodes[j];
var item:Array = new Array(subXmlNode.firstChild, subXmlNode.attributes.link);
submenu.push(item);
}
// create an entry for each chamber
mainmenu.push(submenu);
}
}
// EDIT 2
I am now running this file from a remote server (Linux box), but still only the first element loads on Windows, with no siblings. On Mac, everything loads fine, I am at a dead end, my deadline (draft #2) for this is in about 12hours and I still need to get a night's rest in. Does anyone have the slightest inkling what this could be? Any pointers or advice will be cordially accepted. The url
Regards and TIA.
// EDIT 3
I am now debugging in Windows and have found that the XML file does get loaded completely eventually. What is odd is that I trace the _x
and _y
values of all the movieclips, and all change constantly to an acceptable value, but still only the first-added movieclip is visible on the stage. I have traced their depths which do in fact differ, they are enabled (traced), they are _visible
(traced that also), everything works perfect on Mac, except when I run it on Windows, so clearly, Flash Player in Windows in doing something unexpected, has anybody encountered this before?
I would really appreciate some help.
Regards and TIA.