5 Replies Latest reply on Dec 30, 2008 7:28 AM by kglad

    XML and links attached to an image

    Rob Beckett
      I have a flash web template that loads images from an xml file. One thumbnail size and one large, working well, but I want to link one of the large images to a web page so when you click the image it opens a new browser window with another web page.

      Can you use the <a href="www.tanyaperry.com"/> in the xml file directly. I have no untried method that I know, but that is very very basic knowledge. Can anyone tell me what I can do to get this sorted easily.

      xml code section

      <category name="Order on-line">
      <image thumbnail="images/nelly_tmb.jpg"large="images/nelly.jpg" />

      </category>

        • 1. Re: XML and links attached to an image
          kglad Adobe Community Professional & MVP
          no.

          you need to edit the fla to add that functionality.
          • 2. Re: XML and links attached to an image
            Rob Beckett Level 1
            Thanks that clears that up. Where would I start looking to add that function to the fla file to allow this link?
            • 3. Re: XML and links attached to an image
              kglad Adobe Community Professional & MVP
              start with the code that loads and parses the xml file.
              • 4. Re: XML and links attached to an image
                Rob Beckett Level 1
                Here is the section I think you mean. still do understand what needs to be done here.

                Sample section

                function loadImagesXML(){
                var x:XML = new XML();
                x.ignoreWhite = true;

                idArray = new Array();
                catArray = new Array();
                slideShowArray = new Array();

                x.onLoad = function(success) {
                x.parseXML();
                //categories
                catArray = new Array();
                var myCount = x.firstChild.childNodes.length;
                var rootHandler = x.firstChild.childNodes;

                for(var i=0;i<myCount;i++){
                catArray.push(rootHandler .attributes.name);
                var secHandler = rootHandler
                .childNodes;
                var myCount2 = secHandler.length;
                //thumbnails, large images
                _level0["tmbArray"+i] = new Array();
                _level0["lrgArray"+i] = new Array();
                for(var x=0;x<myCount2;x++){
                _level0.slideShowArray.push(secHandler[x].attributes.large);
                _level0["tmbArray"+i].push(secHandler[x].attributes.thumbnail);
                _level0["lrgArray"+i].push(secHandler[x].attributes.large);
                }
                }
                _level0.slideShowArray.sort(function(a,b) {return (Math.floor(Math.random()*2) == 0) ? 1 : -1;});

                //gotoAndPlay("start");
                _level0.initLogo();
                }

                x.load("images.xml");

                Any suggestions? I have a blank look on my face and no ideas.

                • 5. Re: XML and links attached to an image
                  kglad Adobe Community Professional & MVP
                  you'll need to edit the xml to add the link you want to use when the large image is clicked. then you'll need to edit x.onLoad() to parse the edited xml.

                  and you still need to include code to add the mouse handlers to open the new browser windows.

                  unfortunately, from the way that is setup, the mouse handlers will need to be added somewhere else. start looking in initLogo().

                  in short, this is not an appropriate beginners task.

                  p.s. use the attach code option to display code in this forum.