dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: XML - here is the code , but how do I make a clickable link ?

  1. #1
    Member
    Join Date
    Nov 2004
    Posts
    79

    XML - here is the code , but how do I make a clickable link ?

    Hi all,

    hoping someone can help me. Im a bit of a novice when it comes to XML.
    Im trying to make a clickable link

    here is a sample of the code ,

    Code:
    <kungfu>
        <heading>Tarbert Music Festival</heading>
        <monkey>------------------------------------------------------------ 
        Scott will be playing this years Tarbert music festival with 
        the Lynsey Dolan Band. The event takes place on the weekend
        of the 15th-17th of September. For more details check out 
        www.myspace.com/thelynseydolanband.</monkey>
        <space>-----------------------------------------------------------</space>
    </kungfu>
    i want the "www.myspace.com/thelynseydolanband" to be a clickable link but, to use a scottish phrase;, its doin ma' nut in !

    There must be a simple amendment to the code above that could achieve this surely?

    Any help would be much appreciated,

    Thanks in advance,

    suzi

  2. #2
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    There are tons of ways to skin a cat and I wanted to make an example that was not only easy to understand but one that you could also add upon once you do.

    That said.....using this XML named "example1.xml"

    Code:
    <kungfu>
        <heading>Tarbert Music Festival</heading>
        <monkey>Scott will be playing this years Tarbert music festival with the Lynsey Dolan Band. The event takes place on the weekendof the 15th-17th of September. For more details check out</monkey>
    <link>http://www.myspace.com/thelynseydolanband</link>
    </kungfu>
    and a new flash movie with that a dynamic textfield with html enabled and with an instance name of "my_txt" with this script placed onframe 1:

    Code:
    my_txt.htmlText="";
    myXML = new XML();
        myXML.ignoreWhite = true;
        myXML.onLoad = function(success) {
            if (success) {
    
                mainItem = myXML.firstChild.childNodes;        
                 my_txt.htmlText +="<b><u>"+mainItem[0].firstChild.nodeValue+"</b></u>\n\n";
                 my_txt.htmlText +=mainItem[1].firstChild.nodeValue+" <A HREF=\""+mainItem[2].firstChild.nodeValue+"\"><u>this link</u></A>. ";
                my_txt.htmlText +="\n";
       }}
    myXML.load("http://flashnow.servebbs.com/examples/example1.xml");
    stop();
    I will end up with this:

    http://flashnow.servebbs.com/examples/suzisweet.html

    This is just one of many many ways to parse and distribute node values and is very basic on purpose. I also chose to send it to a master textfield on purpose to show how to concatenate (piece together)the node returns into not only a textfeild display you can control (using any of the available text commands flash supports) and also how to make a portion a link. Hope it helps in some way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center