Connecting Tech Pros Worldwide Forums | Help | Site Map

XML links not working in Flash

npm npm is offline
Member
 
Join Date: Apr 2007
Posts: 36
#1: Oct 31 '08
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...everything I have in between the CDATA tags.

Here's the actionscript I'm using:
Expand|Select|Wrap|Line Numbers
  1. function loadXML(loader) {
  2.     stations = loader.firstChild.childNodes;
  3.     for (var i=0; i<stations.length; i++) {
  4.         city = stations[i].firstChild;
  5.         freq = stations[i].childNodes[1];
  6.  
  7.         txtCity.text += city.firstChild.nodeValue + "\n";
  8.         txtFrequency.text += frequency.firstChild.nodeValue + "\n";
  9.         }
  10.     }
  11.  
  12. xmlData = new XML();
  13. xmlData.ignoreWhite = true;
  14. xmlData.onLoad = function(success) {
  15.     if (success) loadXML(this);
  16.     else trace("Error loading XML file");
  17.     }
  18. xmlData.load("xml/stations.xml");
  19.  
All the cities display correctly, except the ones with links in the xml. I end up getting the whole URL: <a href="....">City</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's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
#2: Oct 31 '08

re: XML links not working in Flash


Quote:

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.onrelease() handler...It would be kind of hard though.

joedeene
Reply