A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: assigning array values to a combo box

  1. #1
    Senior Member
    Join Date
    Dec 2005
    Posts
    135

    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

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Humm this looks vaugly familiar. What version of flash are you using?
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    here do this:

    instanceNameofComboBox.dataProvider = nameOfArray

    make sure to capitalize the P. so :

    compare1.dataprovider = parentArray:

    should be:

    compare1.dataProvider = parentArray:
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center