A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loading XML - A.XML.Newbie.Problem?

  1. #1
    Junior Member
    Join Date
    Feb 2002
    Posts
    2

    Post

    Testing the movie traces "false":
    (First frame, no buttons, no nothing)
    myXML = new XML();
    myXML.load("realdoc.xml");
    trace(myXML.loaded);

    I've tried a hell lot of Templates of yours. For example the "Ticker" and others with attached *.as-files. They all working fine.
    I've reduced the FLA and XML-file to the simplest.

    Whats going wrong?

  2. #2
    Junior Member
    Join Date
    Jan 2001
    Posts
    21

    Smile

    .loaded is a test that returns a boolean value to indicate if the XML document has finished loading or not. You are getting false, beacuse you have check immediatly after the initial request is made, and thus doesn't have a chance to finish loading.

    You want it to be more like:

    Code:
    myXML = new XML();
    myXML.onLoad = trace (myXML);
    myXML.load("realdoc.xml");
    Don't hold me to that, but it should be ok. The onLoad method should be called when the document is finished loading. If that doesn't suit you, you can always use

    Code:
    if (myXML.loaded){
        trace (myXML);
    }
    in a loop to perform multiple statements, but its up to whatever you feel happiest with. Oh and of course you replace trace (myXML) with whatever you want to be called when the document is loaded, like a whitespace remover.

  3. #3
    Junior Member
    Join Date
    Feb 2002
    Posts
    2

    Thanx!

    Thanx

    Originally posted by The_Offspring
    .loaded is a test that returns a boolean value to indicate if the XML document has finished loading or not. You are getting false, beacuse you have check immediatly after the initial request is made, and thus doesn't have a chance to finish loading.

    You want it to be more like:

    Code:
    myXML = new XML();
    myXML.onLoad = trace (myXML);
    myXML.load("realdoc.xml");
    Don't hold me to that, but it should be ok. The onLoad method should be called when the document is finished loading. If that doesn't suit you, you can always use

    Code:
    if (myXML.loaded){
        trace (myXML);
    }
    in a loop to perform multiple statements, but its up to whatever you feel happiest with. Oh and of course you replace trace (myXML) with whatever you want to be called when the document is loaded, like a whitespace remover.

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