Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to add URL links in XML file?

New Here ,
May 05, 2011 May 05, 2011

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[&lt;a href=&quot;http://www.google.ca&quot;&gt;Google&lt;/a&gt;]]></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.

TOPICS
ActionScript
16.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 05, 2011 May 05, 2011

Use straight html tags inside CDATA - after all this what CDATA is for.


Translate
Advocate ,
May 05, 2011 May 05, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 05, 2011 May 05, 2011

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 05, 2011 May 05, 2011

Use straight html tags inside CDATA - after all this what CDATA is for.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2011 May 06, 2011
LATEST

Thanks Andrei1,

How foolish of me. It was a simple thing. I was unnecessarily making the things complicated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines