1 Reply Latest reply on Aug 22, 2006 5:41 AM by Newsgroup_User

    XML data help

    bbrevet
      Hey all, this is my first shot at trying to import info from an XML file and I am sure many of you will have some ideas on how to tighten my code (by all means suggest), but I am wondering if there is any way to import an exernal image into a MovieClip as opposed to using the Loader Component. I ask of course because you can't apply any motion tweens to Loader. I am assuming this can't be done because it is an external image and I will have to tool around with masking, but if it is possible it would be a great help.

      I placed my ActionScript code below for what I have done so far, any advice is really helpful, and as for an explanation for what I am doing it is just going to be a Featured News section that rotates between four stories and each story will have a button with the assigned URL to get to the story. All that is ready to go I am now in effects stage.

      All the best

      quote:

      function loadXML(loaded) {

      if (loaded) {
      headline0.text = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
      link0 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
      teaser0.text = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
      image0 = this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;

      headline1.text = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
      link1 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
      teaser1.text = this.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
      image1 = this.firstChild.childNodes[1].childNodes[3].firstChild.nodeValue;

      headline2.text = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;
      link2 = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
      teaser2.text = this.firstChild.childNodes[2].childNodes[2].firstChild.nodeValue;
      image2 = this.firstChild.childNodes[2].childNodes[3].firstChild.nodeValue;

      headline3.text = this.firstChild.childNodes[3].childNodes[0].firstChild.nodeValue;
      link3 = this.firstChild.childNodes[3].childNodes[1].firstChild.nodeValue;
      teaser3.text = this.firstChild.childNodes[3].childNodes[2].firstChild.nodeValue;
      image3 = this.firstChild.childNodes[3].childNodes[3].firstChild.nodeValue;

      myLoader.contentPath = image1;
      } else {
      trace("file not loaded!");

      }

      }
      xmlData = new XML();
      xmlData.ignoreWhite = true;
      xmlData.onLoad = loadXML;
      xmlData.load("test.xml");

        • 1. Re: XML data help
          Level 7
          Seems to be more a MovieClip loading question versus XML question.

          > means suggest), but I am wondering if there is any way to import an
          > exernal
          > image into a MovieClip as opposed to using the Loader Component. I ask of
          > course because you can't apply any motion tweens to Loader. I am assuming
          > this
          > can't be done because it is an external image and I will have to tool
          > around
          > with masking, but if it is possible it would be a great help.

          I like to use MovieClipLoader and apply the tween with the onLoadComplete
          event.
          http://livedocs.macromedia.com/flash/8/main/00002543.html



          --
          Lon Hosford
          www.lonhosford.com
          Flash, Actionscript and Flash Media Server examples:
          http://flashexamples.hosfordusa.com
          May many happy bits flow your way!
          "bbrevet" <webforumsuser@macromedia.com> wrote in message
          news:ece787$jj3$1@forums.macromedia.com...
          >