|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Populate combo box with XML
if i have this XML..
<?xml version="1.0"?> <creature> <category id="mammal" has="hairy_skin,mouth,warm_blood"> <species id="cat" has="fur,tail,whiskers"> <breed id="tiger" has="stripey_fur"/> <breed id="lion" has="brown_fur,mane"/> <breed id="panther" has="black_fur"/> </species> <species id="dog" has="hair,tail,wet_nose"> <breed id="labrador" has="soft_hair"/> </species> <species id="pig" has="snout,trotters"/> <species id="cow" has="nose,hooves"/> </category> <category id="reptile" has="scaly_skin,mouth,cold_blood"> <species id="lizard" has="tail,legs"> <breed id="iguana" has=""/> </species> <species id="snake" has="tail,no_legs,forked_tongue"> <breed id="cobra" has="hooded_head"> <subbreed id="greatcobra" has="big_hood"/> </breed> </species> </category> <category id="bird" has="feathers,beak,wings,warm_blood" /> <category id="fish" has="scales,mouth,cold_blood"> <species id="mullet" has="thick_lips"/> <species id="pike" has="sharp_teeth"/> </category> </creature> is there any standard code that i could use to fill up a combo/pull down menu with this information? many thanks |
|
#2
|
|||
|
|||
|
Hi, don't know what you mean by standard code but you should take a look at the flash xml object. You use it like this:
Code:
comboXml = new XML();
comboXml.ignoreWhite = true;
comboXml.onLoad = function(success) {
if (success) {
populateCombo();
}
};
comboXml.load("combodata.xml");
function populateCombo()
{
comboData = _root.comboXml.firstChild.childNodes;
// Now parse it all here
}
The above loads the specified xml file, checks it is all loaded and then calls a function that will parse the data. If your going to be using large amounts of data from xml then you might want to parse the data on the server say with php and then pass the already parsed data into flash. That's because flash tends to pause when reading xml data so if there's alot then you can expect a long pause... |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Populate combo box with XML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|