5 Replies Latest reply on Nov 24, 2008 10:15 AM by Ned Murphy

    Adding hyperlinks to xml document

    PaulBill
      Hi

      I've built a movie in Flash CS3, which calls in both its images and text from an xml file. The one thing I'm having a problem with, is getting some of that text (usually just a url) to function as a hyperlink. Can I code the text within the xml file to include hyperlinks? As an example, this is how one image and accompanying text would look in my xml file;

      quote:

      <image>
      <id>1</id>
      <title>Image 1 heading</title>
      <description>Image 1 text.</description>
      <imageurl>IMAGES/image5.jpg</imageurl>
      </image>


      Many thanks for any help.
        • 1. Re: Adding hyperlinks to xml document
          Ned Murphy Adobe Community Professional & MVP
          What you show would be fine, but it won't create a text-based hyperlink if that's what you are after. Nothing in it resembles what would be a hyperlink (<a> tags). Can you describe what you want to accomplish with respect to what the end product will be and function like?
          • 2. Re: Adding hyperlinks to xml document
            PaulBill Level 1
            Hi Ned

            Thanks for your reply. I realise the text example I gave does not contain a hyperlink. I've tried various bits of code but can't get it to work. What I'm asking is probably very simple, but code has never been my strong point! All the images and text are working fine in the Flash movie, I just need to include urls in the text (all contained within the xml file) which I want to be hyperlinks to the actual websites. I probably won't show the actual url, but would want to use something like 'Click here' with 'Click here' being the hyperlink to the external site. I just need to know how I can code this within the xml file.

            I hope this makes sense!

            Thanks again.
            • 3. Re: Adding hyperlinks to xml document
              Ned Murphy Adobe Community Professional & MVP
              If they are intended to be links in textfields, then there is some special coding needed in the both the xml file and the flash code.

              For the textfield, you need to assign the text as textfield.htmlText = yourLinkText;

              In the XML file, you need to tell it to ignore tags that are intended as html tags and not tags of the xml structure by enclosing the html using

              <![CDATA[ your html ]]>

              <urlLink><![CDATA[ <a href="...whatever">Click Here</a> ]]></urlLink>



              • 4. Re: Adding hyperlinks to xml document
                PaulBill Level 1
                Hi Ned

                Thanks for your reply. I'm slightly confused, however. The code that attaches to the Flash document - textfield.htmlText = yourLinkext; - the same picture box calls in the text, so how can I specify the link text? There's quite a lot of text which breaks down into sections, depending on which image you click (when you click on the image, it turns around to reveal the text on the back). Each image, or section of text, will have its own url, but all of the text runs into the same picture box. I'm also not clear what/where I need to attach the code in Flash.

                Apologies if I didn't make things clear enough in my first post or if I'm misunderstanding your instructions (which I probably am!).

                Thanks again.

                Paul
                • 5. Adding hyperlinks to xml document
                  Ned Murphy Adobe Community Professional & MVP
                  I'm beyond slightly confused. I showed you how you go about specifying hyperlinks (and any other html tags) in an xml file so that it can be utilized in a textfield. What you do with it really doesn't matter to me.