Copy link to clipboard
Copied
Hi,
I'm having problem with adding the URL links to the flash output. I'm using the XML file to call images and then the corrsponding links. Images are called correctly but when I try to add a link I'm not getting the links, but instead getting the HTML anchor tags as texts. I'm using the XML escape characters to escape the HTML tags but the results are not what I need.
I'm using the following code:
<thumbnail preview="large.jpg" thumb="thumb.jpg">
<title><![CDATA[Finance Services]]></title>
<discription><![CDATA[<a href="http://www.google.ca">Google</a>]]></discription>
</thumbnail>
---------------------------
Output:
Images are displayed correctly, but instead of getting the links, I'm getting following text message:
<a href="http://www.google.ca">Google</a>
I need to find out what I'm doing wrong. Am I using the correct way to add the links or not?
Thanks for your time.
1 Correct answer
Use straight html tags inside CDATA - after all this what CDATA is for.
Copy link to clipboard
Copied
hi
are you setting the textfield with tf.text = ... ? if so, try tf.htmlText = ....
not sure if html links work in textfields though - i would use navigateToURL in response to a click event
Copy link to clipboard
Copied
I'm using following code for the Description part, where I need to place the HTML tags:
var _discription:TextField = previewHolder.discriptionText.discriptionText;
_discription.htmlText = _xml.thumbnails.thumbnail[photoNum].discription.toString()
I'm using the htmlText, I tried replacing htmlText with tf.htmlText, but it didn't work. I'm importing the text field using import flash.text.TextField; do I need to import something for HTML tags to work?
Copy link to clipboard
Copied
Use straight html tags inside CDATA - after all this what CDATA is for.
Copy link to clipboard
Copied
Thanks Andrei1,
How foolish of me. It was a simple thing. I was unnecessarily making the things complicated.

