Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call url from xml into getURL in actionscript

Status
Not open for further replies.

manoj382

Programmer
Jul 5, 2007
2
US
*******************

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>2.jpg</image>
<link> </pic>
</images>

*******************

I have this simple XML document with one image and a corresponding link and would like to be able to click the image and have the user directed to the url in the link.

If I use getURL(" it will obviously work, but I want to use a variable there instead of the actual URL so I can easily update it through the XML document. What's the syntax for this? Or am I missing something altogether?

Many thanks,
Manoj
 
called your xml file link.xml

code in frame 1 of the movie


Code:
url_xml = new XML();
url_xml.ignoreWhite = true;
url_xml.onLoad = function() {
	image = url_xml.firstChild.childNodes[0].firstChild.firstChild.nodeValue;
	link = url_xml.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
	images(image, link);
};
url_xml.load('link.xml');
function images(pic, url) {
	this.createEmptyMovieClip("_mc", 1);
	mcl = new MovieClipLoader();
	ear = new Object();
	ear.onLoadComplete = function(target) {
		target.onRelease = function() {
			getURL(url);
		};
	};
	mcl.addListener(ear);
	mcl.loadClip(pic, _mc);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top