Hello. I'm creating an interactive map. The base map (first scene, first frame) has only building outlines and streets. Above the map are several drop down lists (using comboboxes). If the user selects an item in the combobox, the corresponding building is highlighted and labeled. So far I've accomplished this by creating a different scene for each building, different from the base in that it also includes the highlight and label. I'm keeping the building information in an XML file so it can be easily updated:
<?xml version="1.0" standalone="yes"?>
<buildings>
<site siteName="Building01" Data="B1"></site>
<site siteName="Building02" Data="B2"></site>
<site siteName="Building03" Data="B3"></site>
</buildings>
My actionscript to link the comboboxes with the XML files is:
//create a new XML object
thisXML = new XML();
//ignore whitespace in the file
thisXML.ignoreWhite = true;
//call the LoadChartData function when the XML file is loaded
thisXML.onLoad = LoadCombo;
//load the xml file
thisXML.load("buildings.xml");
function LoadCombo(success) {
if (success) {
//set variables
var BaseNode=thisXML.childNodes[0];
var ComboSites = new Array();
var ComboData = new Array();
var ThisNode;
//set .dataprovider "not needed but nice to have"
CBOLoadBuildings.setDataProvider(ComboSites);
//add the default item to the combo box
CBOLoadBuildings.addItem("--Buildings--");
//get building information
for (i=0; i < BaseNode.childNodes.length; i++) {
ThisNode = BaseNode.childNodes;
ComboSites = ThisNode.attributes["siteName"];
ComboData = ThisNode.attributes["Data"];
//add to combo box
CBOLoadBuildings.addItem(ComboSites,ComboData);
}
}
}
//Function Call for navigation and to restore comboBoxes
CBOLoadbuildings.setchangeHandler("navigateBuildings");
//functions
function navigateBuildings() {
if (CBOLoadBuildings.getSelectedItem().data != null){//stops recursion by checking for valid selection
CBOLoadAcademic.setSelectedIndex(0);
CBOLoadAdmin.setSelectedIndex(0);
CBOLoadResidence.setSelectedIndex(0);
CBOLoadCamp.setSelectedIndex(0);
_root.gotoAndPlay(CBOLoadBuildings.getSelectedItem().data);
}
}
stop();
I have several questions:
1. The menus are not working. Nothing happens when an item is selected. Any idea why?
2. Do you know a better way to accomplish what I am trying to do?
3. I want the menus to reset once an item is selected. So if I select "Building01" I want the menu to automatically reset to show "--Buildings--". Do you know how to do this?
Thanks for any help you can provide,
malpeigne
<?xml version="1.0" standalone="yes"?>
<buildings>
<site siteName="Building01" Data="B1"></site>
<site siteName="Building02" Data="B2"></site>
<site siteName="Building03" Data="B3"></site>
</buildings>
My actionscript to link the comboboxes with the XML files is:
//create a new XML object
thisXML = new XML();
//ignore whitespace in the file
thisXML.ignoreWhite = true;
//call the LoadChartData function when the XML file is loaded
thisXML.onLoad = LoadCombo;
//load the xml file
thisXML.load("buildings.xml");
function LoadCombo(success) {
if (success) {
//set variables
var BaseNode=thisXML.childNodes[0];
var ComboSites = new Array();
var ComboData = new Array();
var ThisNode;
//set .dataprovider "not needed but nice to have"
CBOLoadBuildings.setDataProvider(ComboSites);
//add the default item to the combo box
CBOLoadBuildings.addItem("--Buildings--");
//get building information
for (i=0; i < BaseNode.childNodes.length; i++) {
ThisNode = BaseNode.childNodes;
ComboSites = ThisNode.attributes["siteName"];
ComboData = ThisNode.attributes["Data"];
//add to combo box
CBOLoadBuildings.addItem(ComboSites,ComboData);
}
}
}
//Function Call for navigation and to restore comboBoxes
CBOLoadbuildings.setchangeHandler("navigateBuildings");
//functions
function navigateBuildings() {
if (CBOLoadBuildings.getSelectedItem().data != null){//stops recursion by checking for valid selection
CBOLoadAcademic.setSelectedIndex(0);
CBOLoadAdmin.setSelectedIndex(0);
CBOLoadResidence.setSelectedIndex(0);
CBOLoadCamp.setSelectedIndex(0);
_root.gotoAndPlay(CBOLoadBuildings.getSelectedItem().data);
}
}
stop();
I have several questions:
1. The menus are not working. Nothing happens when an item is selected. Any idea why?
2. Do you know a better way to accomplish what I am trying to do?
3. I want the menus to reset once an item is selected. So if I select "Building01" I want the menu to automatically reset to show "--Buildings--". Do you know how to do this?
Thanks for any help you can provide,
malpeigne