4 Replies Latest reply on Aug 3, 2007 12:13 PM by alanwallace4

    Now ive got this far...

    alanwallace4 Level 1
      So what im trying to do is get the hang of loading in data using xml.
      I can manage to load text into my movie but i would like to add pictures as well.
      Not a slideshow though. Just singular pictures.

      So here is my xml at present

      <?xml version="1.0"?>

      <sitetitle>Your Company</sitetitle>
      <subtitle>Your Text</subtitle>

      and the code i am using within my movie is this ....

      function loadXML(loaded) {
      if (loaded) {
      _root.sitetitle = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
      _root.subtitle = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
      _root.main.title1.title2.titletext.text = _root.sitetitle;
      _root.main.subtitle1.subtitle2.subtitletext.text = _root.subtitle;

      } else {
      trace("file not loaded!");
      xmlData = new XML();
      xmlData.ignoreWhite = true;
      xmlData.onLoad = loadXML;

      My picture (pic1.jpg) is held in a folder named "images" within the root folder.

      I would be ever so grateful for any assistance given.

        • 1. Re: Now ive got this far...
          Rothrock Level 5
          So what is the problem? Do you already know how to load in external pictures? If not, drop the XML for a bit and practice using the MovieClipLoader class. Once you've got that down, then it is just a simple mater of reading the XML node and passing it to the MCL for loading.

          Remember that paths for external files in Flash are relative to the html or projector and not to the swf calling the asset.
          • 2. Now ive got this far...
            alanwallace4 Level 1
            Thanks for your reply.
            I figure using xml to load in a picture is easy for the client so i am tryng to find a way to do it.
            I am loading the text with xml and i would have liked to use the same xml file for the pictures as well. There are many tutorials out there but i havent found one which deals with loading individual pictures in.
            • 3. Re: Now ive got this far...
              Rothrock Level 5
              But do you know how to load just one picture regardless of the source of the file name? In other words, do you know how to use the MovieClipLoader class?

              Actually I think the help file for the MCL has just the code you need – should be the only tutorial you need!

              And yes this is a great way to go about it. Many clients can be taught to change an XML file – of course some can't… :)
              • 4. Re: Now ive got this far...
                alanwallace4 Level 1
                Thanks Rothrock. I'll go check it out.
                Thanks for the advice.