XML links not working in Flash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • npm
    New Member
    • Apr 2007
    • 57

    XML links not working in Flash

    Hi,
    I've got a list of radio stations that load from an XML file into dynamic textboxes. The text loads fine, but some of them have links that are supposed to show up, but they don't. Flash ends up displaying the entire URL as well as the text...everythi ng I have in between the CDATA tags.

    Here's the actionscript I'm using:
    Code:
    function loadXML(loader) {
    	stations = loader.firstChild.childNodes;
    	for (var i=0; i<stations.length; i++) {
    		city = stations[i].firstChild;
    		freq = stations[i].childNodes[1];
    		
    		txtCity.text += city.firstChild.nodeValue + "\n";
    		txtFrequency.text += frequency.firstChild.nodeValue + "\n";
    		}
    	}
    
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = function(success) {
    	if (success) loadXML(this);
    	else trace("Error loading XML file");
    	}
    xmlData.load("xml/stations.xml");
    All the cities display correctly, except the ones with links in the xml. I end up getting the whole URL: <a href="....">Cit y</a>. In HTML, it works fine using javascript to make the link show up. Is there way to do this in actionscript?

    Thanks in advance!
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    Originally posted by npm
    ...In HTML, it works fine using javascript to make the link show up. Is there way to do this in actionscript?

    Thanks in advance!
    Well, what's the JavaScript code you're using to make them links, Because JavaScript and actionscript, or pretty similar. Also, I don't know if text boxes support links, unless you're loading each one into a new text box. Then, you could just create a movieClip of each textbox and use the movieclip.onrel ease() handler...It would be kind of hard though.

    joedeene

    Comment

    Working...