Page 1 of 1

How do i load an url (defined in xml) into flash mx

Posted: Fri Dec 16, 2005 4:00 pm
by ren39
Hi all,

Hopefully there is someone who can help me with this question?


Case
I'm trying to build a list with hyperlinks (from an xml-file) and want to load this in a Dynamic textfield in Flash MX2004.

Other resources
http://www.xfactorstudio.com

What i'm using
I used the following 'application' XPath XML Search engine downloaded at:
http://www.sephiroth.it/file_detail.php?id=130



The code

XML- list:

<season s="1">
<ep n="1" >
<id>1-01</id>
<d>Test</d>
<dn>86023</dn>
<name>CIS</name>
<dt>13122005</dt>
<gs>Test</gs>
<url>http://www.google.com</url>
</ep>
</season>

ACTIONSCRIPT 2.0 in FlashMovie:
* Here i get the url 'array' and load this in a Dynamic textarea with instance name 'taUrl'.



// Converts myResults array of xml nodes to regular array
// this part was made with the help of Neeld
myDataSet = new Array();
for (var i = 0; i<myResults.length; i++) {
var name = XPath.selectNodes(myResults, "./name" [0].firstChild.nodeValue;
var id = XPath.selectNodes(myResults, "./id" [0].firstChild.nodeValue;
var dn = XPath.selectNodes(myResults, "./dn" [0].firstChild.nodeValue;
var link = XPath.selectNodes(myResults, "./link" [0].firstChild.nodeValue;
var url = XPath.selectNodes(myResults, "./url" [0].firstChild.nodeValue;
myDataSet.push({Name:name, ID:id, DN n});
}



// set Url in taUrl textbox
var choosenUrlText = XPath.selectNodes(choosenEpisodeData, "./url" [0].firstChild.nodeValue;
choosenUrlText = choosenUrlText.toString();
var newString3 = choosenUrlText.searchReplace();
var newString3 = choosenUrlText.searchReplace(term,"<a href='http://"+term+" / >" ;
taUrl.text = newString3;


Resulting in

a 'plain' text --> http://www.google.com

AND IS NOT CLICK-ABLE! And that is my problem.

Thanks for responding,
Webmaster Freestyler.