PDA

View Full Version : need help with xml gallery



robertr81
11-06-2006, 03:27 AM
Iīm using a xml gallery with thumbs . I tried several things but canīt get it work. I want to add links in the textfield. The text in the textfield comes from a .txt file and xml file. I dont know if itīs possible to add links in .txt files or if there is any other way to open urls with links for the different images.

I hope someone can help me with this..

file included...
http://www.robertr.se/flash/portfoliopage.zip
207 kb

Very best regards
/Robert

parodeis
09-28-2008, 12:03 AM
I have wondered the same thing. When I try to code the url link inside the xml, flash just ignores the text, or displays the a href as if it were regular text.

I am working in actionscript 2 here, but have you checked to see if the dynamic text fields are rendering in html, and that the actionscript is defining them as .htmlText instead of .text?

Heres a snippet from mine:

picture._alpha = 0;
picture.loadMovie(image[p], 1);
client_txt.htmlText = client[p];
ttl_txt.htmlText = ttl[p];
desc_txt.htmlText = description[p];
picture_num();

client_txt, for example, is an instance name for a dynamic text field on the stage. See if on your file the instance name is client_txt.htmlText, not client_txt.text. Changing that may help, but I'm not sure. I am pretty new to actionscript myself. It would be really nice to have this option!

Good luck!

Medyman
09-29-2008, 02:20 AM
It's actually quite simple to add a link through XML. For testing purposes, I'll describe a simple UI. Open up Flash and add a simple dynamic text field to the stage. Let's give it an instance name of textfield.

Next, open up the Actions panel, and add the following AS:


var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
textfield.html = true;
textfield.htmlText = this.firstChild.childNodes[0].childNodes[0];
}
xml.load("test.xml");

This should be familiar to you if you're already using XML. Note that I'm turning on the html property of the text field.

Next, create a XML document saved as test.xml with the following contents:

<xml>
<link><a href="http://www.google.com">Google</a></link>
</xml>

Finally, go back to Flash and test. You should have a working link.

Note: If you're using XML and flat text files, you're probably over-complicating your workflow.