A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: XML _blank URL Linkage.... [MX04]

  1. #1

    XML _blank URL Linkage.... [MX04]

    Hello,
    My flash file pulls in some XML info to make hyperlinks. However, I can't seem to figure out how to make the links come up in new (_blank) windows.

    Any ideas?

    Thanks! Brian

    XML code:

    <broadcast>
    <story>
    <lead>Project Title</lead>
    <body>Description of project goes here.</body>
    <URL>http://www.mylink.com</URL>
    </story>
    </broadcast>

    -----

    AS:

    // The first step is to activate the XML object
    headlineXML = new XML();
    /*
    With the XML Object now active you must now load an XML foramtted document.
    Any DTD or XLS formatting will be ignored.
    */
    headlineXML.onLoad = myLoad;
    headlineXML.load("headlines.xml");
    // Before proceeding to far into the program, make sure the XML document has loaded
    // Extract information from the XML file
    function myLoad(ok) {
    if (ok == true) {
    Publish(this.firstChild);
    }
    }

    function Publish(HeadlineXMLNode) {
    if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
    content = "";
    story = HeadlineXMLNode.firstChild;
    while (story != null) {
    if (story.nodeName.toUpperCase() == "STORY") {
    lead = "";
    body = "";
    URL = "";
    element = story.firstChild;
    while (element != null) {
    if (element.nodeName.toUpperCase() == "LEAD") {
    lead = element.firstChild.nodeValue;
    }
    if (element.nodeName.toUpperCase() == "BODY") {
    body = element.firstChild.nodeValue;
    }
    if (element.nodeName.toUpperCase() == "URL") {
    URL = element.firstChild.nodeValue;
    }
    element = element.nextSibling;
    }
    content += "<font size='+2' color='#ffffff'><a href='"+URL+"'>"+lead+"</a></font><br>"+body+"<br><br>";
    txt.htmltext=content;
    }
    story = story.nextSibling;
    }
    }
    }

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    content += "<font size='+2' color='#ffffff'><a href='asfunction:myFunction,"+Url+"'>"+lead+"</a></font><br>"+body+"<br><br>";
    txt.htmlText=content;
    
    function myFunction(param){
    trace(param);
    getURL(param, "_blank");
    };
    hth

  3. #3
    wow, you've got skillz. Thank you 100 times over.

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