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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SWF detecting folder name 1

Status
Not open for further replies.

carmenMiranda

Programmer
May 22, 2003
47
GB
Is it possible for an SWF to detect the name of the folder that it resides in at runtime? And then pass that folder name as a variable to a function? If this is possible, would someone point me in the right direction as to how to do it?

Thanks.
 
Code:
[b]var path:String = this._url;
path = path.substring(0, path.lastIndexOf("/")+1);[/b]
var destinationURL:String;
var externalData:XML = new XML();
externalData.ignoreWhite = true;
externalData.onLoad = parse;
externalData.load([b]path+[/b]"targetURL.xml");
function parse(success) {
	if (success) {
		destinationURL = String(this.firstChild.attributes.address);
		if (destinationURL == "") {
			destinationURL = "[URL unfurl="true"]http://uk.yahoo.com";[/URL]
		}
	} else {
		trace("XML document not loaded");
	}
}
this.clickBtn.onRelease = function() {
	getURL(destinationURL, "_self");
};

Kenneth Kawamoto
 
This is an excellent solution to the problem I've been having and as with all excellent solutions, it now seems so obvious :)

However, I hadn't worked it out after 2 days of trying, so many, many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top