A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Abandoned Children

  1. #1
    ...in human form
    Join Date
    Aug 2002
    Posts
    188

    Abandoned Children

    I have a well formed xml doc, which I load into flash via:

    Code:
    myXML = new XML ();
    myXML.load ("stuff.xml")
    But when I try to begin working with that xml which is multi tiered it comes back with myXML as only one node. No children at all. Am I missing something. Even checking the nodeValue and nodeName of myXML give null and undefined responses. But if i trace myXML the whole XML outputs. But almost like a text variable. Any ideas?
    Incarnations

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhm...

    How about some sample XML and AS?
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

  3. #3
    ...in human form
    Join Date
    Aug 2002
    Posts
    188
    i don't have actual xml here at work but here's an idea of the structure:

    Code:
    <inc>
        < menu title="contents" >
             < submenu title="bio" over="see my bio" click="actionscript:bio" / >
             < submenu title="portfolio" over="see my portfolio" click="actionscript:portfolio" / >
             < submenu title="links" over="places to visit" click="actionscript:links" / >
        < /menu >
        < content >
           < bio title="my bio" >
                < p >blah blah blah< /p >
                < p >blah blah blah< /p >
           < /bio >
           < portfolio >
    //get the picture
        < /content >
    < /inc >
    Then the actionscript is something like:

    Code:
    myXML = new XML ();
    myXML.load ("myXML.xml");
    myXML.onLoad = function (success){
         myXML = myXML.parseXML;
         //in here at this stage i just started trying a whole bunch of trace functions to see how to get to the various nodes when i found out i couldn't access any of them...
    }
    I'm wondering if its related to the fact that i'm writing the xml in dreamweaver as xml and it is automatically tiered with whitespace. but even when i put an ignoreWhiteSpace in there it gives me nothing.
    Incarnations

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhm...

    Your XML isn't complete - and I know you mentioned that. If you could get a 'complete' sample that would allow us to give you direct answers to your XML formatting. Complete doesn't mean you have to show working or actual XML or even all of the XML... just a complete sample of the structure.

    Your AS has some mistakes.

    You'll want to declare the onLoad event handler before you load the XML. That way, when your XML loads the XML Object you're storing it in will already know what to do.

    Another point: When the onLoad event is invoked it is because the XML has not only finished 'loading' from the 'server' - but because it has already been parsed into a DOM-able XML Object. So you don't need to explicitly call 'parseXML'. What does happen is that the function you assign to handle the event 'onLoad' will receive one Boolean parameter. This Boolean parameter tells you if the 'loading' of the XML was successful. Remember 'loading' includes parsing. A mistyped URL for the document as well as a malformed XML structure will cause the 'loading' to send a 'false' Boolean to the onLoad event handler.

    <sigh> I've talked enough ...
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

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