PDA

View Full Version : create a link from xml



Flashmatazz
March 8th, 2004, 04:33 AM
I'm trying to create a link in a html enabled textfield, using an xml file.

However somehow this doesn't work:


main["item"+i].title.html = true;
trace(my_XML.firstChild.childNodes[i].attributes.action); // traces the attribute containing the url correctly
main["item"+i].title.htmlText = "<a href=\"" + my_XML.firstChild.childNodes[i].attributes.action + "\" target=\"_blank\">";
main["item"+i].title.htmlText += my_XML.firstChild.childNodes[i].attributes.title;
main["item"+i].title.htmlText += "</a>";
main["item"+i].title.setTextFormat(titleFormat);

When I debug, I see the ending < /a> tag showing up but not the begintag and the contents of action attribute.

I tested the following and this actually does work:


myURL = "http://www.kirupa.com";
this.createTextField("myField", 1, 0, 0, 100, 20);
myField.html = true;
myField.htmlText = "<a href=\"" + myURL + "\" target=\"_blank\">" + myURL;
myField.htmlText += "</a>";


How come??

ScriptFlipper
March 8th, 2004, 02:03 PM
try this instead:

myField.htmlText = "<a href='"+myURL+"' target='_blank'>"+myURL;

Flashmatazz
March 8th, 2004, 03:39 PM
I already tried the single quotes but it doesn't make a difference.

And what the strange part is: it works when I input html combined with a url from within Flash but not when combined with a value from an xml file.

Any other ideas, 'cause this is driving me nuts :bounce:

Flashmatazz
March 9th, 2004, 02:42 AM
No one knows ???