# Web link in Dynamic Text Box from XML file

**URL:** <https://forum.kirupa.com/t/web-link-in-dynamic-text-box-from-xml-file/188066>\
**Category:** flash\
**Created:** [May 4, 2006, 10:17am UTC](https://forum.kirupa.com/t/web-link-in-dynamic-text-box-from-xml-file/188066 "2006-05-04T10:17:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kcharity](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kcharity/32/2424_2.png) [@kcharity](https://forum.kirupa.com/u/kcharity)\
**Post date:** [May 4, 2006, 10:17am UTC](https://forum.kirupa.com/t/web-link-in-dynamic-text-box-from-xml-file/188066/1 "2006-05-04T10:17:18Z")

</div>

I have a flash file that loads in an xml file. (based off of the photo gallery with xml tutorial on this website) I updated it to add another node to include a weblink, here is a sample of the xml.

> \<images\>  
> \<pic\>  
> \<image\>image01.jpg\</image\>  
> \<productname\>Name01\</productname\>  
> \<productdesc\>Some descriptive text\</productdesc\>  
> \<productsite\>www.website01.com\</productsite\>  
> \</pic\>  
> \<pic\>  
> \<image\>image02.jpg\</image\>  
> \<productname\>Name02\</productname\>  
> \<productdesc\>Some descriptive text\</productdesc\>  
> \<productsite\>www.website02.com\</productsite\>  
> \</pic\>  
> \</images\>

Now in the flash file I have the image loading. Then three separate dynamic text boxes. They each load their respective text.

**The problem is with the last text box. How do I make is so that the text in the box is a link to that website and opens in a new window when clicked?**

I have tried formating as HTML checked on the text box…and changed the code in the xml to read as follows.

> \<productsite\>\<![CDATA[\<a href=“[http://www.website01.com](http://www.website01.com)” target=“\_blank”\>www.bebsite01.com \</a\>]]\>\</productsite\>

\*\*With no luck either, it just displays the entire contents.  
\*\*

Here is the AS in the flash file.

> function loadXML(loaded) {  
> if (loaded) {  
> xmlNode = this.firstChild;  
> image = ;  
> productname = ;  
> productdesc = ;  
> productsite = ;  
> total = xmlNode.childNodes.length;  
> for (i=0; i\<total; i++) {  
> image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
> productname\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
> productdesc\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
> productsite\* = xmlNode.childNodes\*.childNodes[3].firstChild.nodeValue;  
> }  
> firstImage();  
> } else {  
> content = “file not loaded!”;  
> }  
> }  
> xmlData = new XML();  
> xmlData.ignoreWhite = true;  
> xmlData.onLoad = loadXML;  
> xmlData.load(“products.xml”);  
> /////////////////////////////////////  
> p = 0;  
> this.onEnterFrame = function() {  
> filesize = picture.getBytesTotal();  
> loaded = picture.getBytesLoaded();  
> preloader.\_visible = true;  
> if (loaded != filesize) {  
> preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
> } else {  
> preloader.\_visible = false;  
> if (picture.\_alpha\<100) {  
> picture.\_alpha += 10;  
> }  
> }  
> };  
> function nextImage() {  
> if (p\<(total-1)) {  
> p++;  
> if (loaded == filesize) {  
> picture.\_alpha = 0;  
> picture.loadMovie(image[p], 1);  
> desc\_txt.text = productname[p];  
> edu\_txt.text = productdesc[p];  
> site\_txt.text = productsite[p];  
> picture\_num();  
> }  
> }  
> }  
> function prevImage() {  
> if (p\>0) {  
> p–;  
> picture.\_alpha = 0;  
> picture.loadMovie(image[p], 1);  
> desc\_txt.text = productname[p];  
> edu\_txt.text = productdesc[p];  
> site\_txt.text = productsite[p];  
> picture\_num();  
> }  
> }  
> function firstImage() {  
> if (loaded == filesize) {  
> picture.\_alpha = 0;  
> picture.loadMovie(image[0], 1);  
> desc\_txt.text = productname[p];  
> edu\_txt.text = productdesc[p];  
> site\_txt.text = productsite[p];  
> picture\_num();  
> }  
> }  
> function picture\_num() {  
> current\_pos = p+1;  
> pos\_txt.text = current\_pos+" / "+total;  
> }

/////////////////////////////////////  
listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
prevImage();  
} else if (Key.getCode() == Key.RIGHT) {  
nextImage();  
}  
};  
Key.addListener(listen);  
previous\_btn.onRelease = function() {  
prevImage();  
};  
next\_btn.onRelease = function() {  
nextImage();  
};
