Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Hyperlink from XML

Question posted by: ryrocks (Newbie) on July 11th, 2008 02:43 PM
Hi everyone,
I’m having a bit of trouble with my flash carousel. I’m pulling in the image source and descriptive text from an .XML file. This works just fine :-)
However, I want a button with a hyperlink that takes the user to another page, the URL must be specified in the .XML file, as I will be pulling in various URLs.

I've broken down my example to the basic problem:
Here's my AS code that pulls in the text - this is on frame 1 of the AS layer:

function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.link = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
link_txt.text = _root.link;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("inventors.xml");

url = _root.link


I have a button on the stage with the following AS:

on (release) {

getURL(url,"_self");

}

As you can see on the final line of my button AS where the URL is usually declared as a string I have placed my variable url which is assigned to _root.link.

This does not work! The URL is undeclared. Any help would be much appreciated!

Ryan
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Reply
Not the answer you were looking for? Post your question . . .
182,531 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Flash / Actionscript Forum Contributors