dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Finding only base nodes of an XML file

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    83

    resolved [RESOLVED] Finding only base nodes of an XML file

    Hello, I have an xml file with various nodes and want to get first nodes of it, not children. Here's my code:

    Code:
    function processXML(event:Event):void {
        menu_xml = new XML(event.target.data);
        trace (menu_xml.child("mainmenu"));
    }
    This code doesn't output anything. I'm using Flash Professional CC 2015.0.

    Here's the xml content:

    Code:
    <?xml version="1.0"?> 
    <mainmenu>
    
        <home/> 
        <portfolio/> 
        <contact/> 
        <friends>
    
            <joe/> 
            <karen/> 
            <bob/> 
    
        </friends>
    
    </mainmenu>

  2. #2
    Member
    Join Date
    Nov 2007
    Posts
    83

    Thumbs up

    Anyway, this solved the problem:

    Code:
    for each (var node:XML in menu_xml.children()) {
    	trace(node.name());
    }

Tags for this Thread

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