5 Replies Latest reply on Nov 12, 2007 5:47 PM by joeflashTO

    XML

    popet
      Hello
      I have an application that loads data from an xml file.
      I can happily run it from the html or click the .swf to use the projector but when I compile the exe, no data gets loaded. Why it isn´t work?, What do you recoment me ? thanks

      WR
        • 1. Re: XML
          joeflashTO
          What code are you using to load the data? Let's a have a look at some actionscript (in the Attach Code window).
          • 2. Re: XML
            popet Level 1
            I have a external image.swf it load some external photos from a XML file.
            the image.swf it called by the mother movie, here the action that I use on the bottom.

            on (release) {
            loadMovie("image.swf", "mygallery");
            }

            All works fine but, the problem is when I compile the mother.swf to exe, its no load any data from the XML.

            Here part of the code where I call the xml (it is in image.swf)

            function loadXML(_arg2) {
            if (_arg2) {
            xmlNode = this.firstChild;
            image = [];
            txt = [];
            url = [];
            thumb = [];
            total = xmlNode.childNodes.length;
            i = 0;
            while (i < total) {
            image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
            txt = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
            url = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
            thumb = xmlNode.childNodes.childNodes[3].firstChild.nodeValue;
            gotoAndStop (2);
            i++;
            }
            } else {
            msg.text = "Error loading XML";
            }
            }
            xmlData = new XML();
            xmlData.ignoreWhite = true;
            xmlData.onLoad = loadXML;
            xmlData.load("content.xml");

            Actually I dont know why its not works
            Thanks
            • 3. Re: XML
              joeflashTO Level 1
              Ah I see. Most likely you are calling the XML data in your image.swf at almost the same time as the data is loaded. Loading in a browser, and the standalone player, you are getting lucky and it's working. But with an .exe the load times are too close, and it could very well be that your image.swf is being loaded a fraction of a second before the XML data is ready to be used by the application.

              What you need to do is make sure that image.swf doesn't try to use the XML data until the xmlData.onLoad event is called. Try that and see if it works.
              • 4. Re: XML
                popet Level 1
                Hello again!

                I think the problem is over.
                I check it in other computer and there is no problem; so the problem is my local computer.

                !, Now a new question, why don´t work in my computer, but in others all is ok?

                THAKNS IN ADVANCE joeflashTO

                WR
                • 5. Re: XML
                  joeflashTO Level 1
                  Again, it's probably a fluke that it works, if you're calling the XML data from the SWF at the same time that you're loading the XML data. In an online environment where your XML might load faster than your SWF, you may get more erratic results. So make sure the SWF checks and makes sure it's not calling the XML data until it's loaded.