-
assigning array values to a combo box
hi guys wondered f anyone could help me with this, I have an array which I want the values within to appear in a combo box called compare 1. Not sure how to do this the code is below the last line shows how i tried to do it but to no joy. Much apprechiated if any1 could help
function parseXML(createXML) {
parseArray = new Array();
for (i = 0; i < createXML.childNodes.length; i++)
{
//creates a object with the same name as the node in the xml
this[createXML.childNodes[i].nodeName] = new Object();
//next three lines pass values in XML node attributes to variables in the object
this[createXML.childNodes[i].nodeName].name = createXML.childNodes[i].nodeName;
this[createXML.childNodes[i].nodeName].isa = createXML.childNodes[i].attributes.isa;
//this next line is interesting in that it uses split, which it self creates an array, so it seem you end up passing an array to a variable in the object. However, you then pass the object later to an array.
this[createXML.childNodes[i].nodeName].has = createXML.childNodes[i].attributes.has.split(",");
//appends the newly created object to the array you created earlier, so you end up with an array of objects
parseArray.push(this[createXML.childNodes[i].nodeName]);
} // end of for
//this would set the root level variable creaturesArray to the array of object created in the previous function
_global.entityArray = parseArray;
} // End of the function
//takes the value of creature name
function getParents(entityName)
{
//set variable to a blank value
currentISA = "";
//creates new array
parentArray = new Array();
//adds value of creature name to array.
parentArray.push(entityName);
for (entityIndex = getIndex(entityName); currentISA != null; entityIndex = getIndex(currentISA))
{
//takes value from object and pusshes it to the new array
currentISA = _global.entityArray[entityIndex].isa;
parentArray.push(currentISA);
} // end of for
//removes the last element from the array and returns the value
parentArray.pop();
//returns the array
return (parentArray);
compare1.dataprovider = parentArray:
} // End of the function
sorry about the indentation
Thanks
-
OOP is one letter from OOPS
Humm this looks vaugly familiar. What version of flash are you using?
-
OOP is one letter from OOPS
here do this:
instanceNameofComboBox.dataProvider = nameOfArray
make sure to capitalize the P. so :
compare1.dataprovider = parentArray:
should be:
compare1.dataProvider = parentArray:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|