A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: XML issue with multiple Child nodes

  1. #1
    Junior Member
    Join Date
    Jun 2003
    Posts
    7

    XML issue with multiple Child nodes

    Been working on this for a few days with no luck... Would really appreciate any help given. Thank you in advance for taking the time.

    Basically I'm wanting to take this existing actionsscript and modify it to show all the "labels" for that given day on the calendar.

    reading and writing multiple childNodes

    --------------------------------------------------------------------------------

    function setDay(dayNode_xml,day_num,mc){
    trace("day: " + day_num);
    trace("dayXML: " + dayNode_xml.attributes.value);



    if (dayNode_xml.attributes.value==day_num){
    //-----------------------------------------------
    var itemsNode_xml=dayNode_xml.firstChild;

    trace("yes entry for this day");

    while (itemsNode_xml!=null){
    if (itemsNode_xml.nodeName=="label")
    {
    trace("yes label: " + itemsNode_xml.nodeValue);
    _root[mc].label=itemsNode_xml.firstChild.nodeValue;

    THE ABOVE NEEDS TO BE MODIFIED TO ALLOW MULIPLE EVENTS... I'VE BEEN WORKING ON IT FOR DAYS.... CAN ANYONE HELP?

    }
    else if (itemsNode_xml.nodeName=="description"){
    trace("yes description: " + itemsNode_xml.nodeValue);
    _root[mc].description=itemsNode_xml.firstChild.nodeValue;
    }
    else{
    trace("error");
    }

    itemsNode_xml=itemsNode_xml.nextSibling;
    }

  2. #2
    Junior Member
    Join Date
    Jun 2003
    Posts
    7

    Working example

    content_txt.html = true;

    modContent = new XML();
    modContent.ignoreWhite = true;
    modContent.onLoad = function(){
    var objXML = this.firstChild.childNodes;
    for (i in objXML) content_txt.text += objXML[i];
    }

    modContent.load("calendar.xml");

    This test example works outside the project.
    The result shows both events within the text field. But when I try to use the above code in the code in the actual actionscript in the above post, it doesn't write to the label...

  3. #3
    Junior Member
    Join Date
    Jun 2003
    Posts
    7
    Now its displaying to undefines in the calendar so its holding the array, just not the info.

    {
    trace("yes label: " + itemsNode_xml.childNodes);
    var objXML = itemsNode_xml.childNodes;
    trace("obj:" + objXML);
    for (i in objXML) _root[mc].label += itemsNode_xml.objXML[i];
    trace("obj:" + objXML[i]);

    dayXML: 21
    yes entry for this day
    yes label: Test 1
    obj:Test 1
    obj:Test 1
    yes description: null
    yes label: Test 2
    obj:Test 2
    obj:Test 2
    yes description: null
    ...no more xml day enteries

  4. #4
    Junior Member
    Join Date
    Jun 2003
    Posts
    7
    Found a solution... was looking to deep...

    var objXML = this.firstChild.childNodes;
    should be

    var objXML = this.childNodes;

    Now I can properly display the multiple events on any given day... New challenge is descriptions of the events...

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