check against URL to assign value
Hi,
for the project I'm working on, I need to assign a value to different URL for tracking purposes. the assets will be served on different websites, with each website using a different value.
Currently I have in my class file
import flash.external.*;
public function checkURL() {
//var domainName:String = ExternalInterface.call("window.location.href.toString");
var domainName:String = stage.loaderInfo.loaderURL;
var urlPathSubstring = domainName.substr(7,18);
var urlPathSubstring2 = domainName.substr(7,16);
var urlPathSubstring3 = domainName.substr(7,24);
var urlPathSubstring4 = domainName.substr(7,30);
var urlPathSubstring5 = domainName.substr(7,22);
var urlPathSubstring6 = domainName.substr(7,30);
var urlPathSubstring7 = domainName.substr(7,22);
if(urlPathSubstring2=="http://www.xxxxxxxx.com"){
is_value=0;
}
else if(urlPathSubstring3=="http://staging.xxxxxxxx.com"){
is_value=1;
}
else if(urlPathSubstring7=="http://yyyyyyyy.xxxxxxxx.com"){
is_value=0;
}
else if(urlPathSubstring6=="http://yyyyyyyy.staging.xxxxxxxx.com"){
is_value=1;
}
else if(urlPathSubstring5=="http://zzzzzzzzz.xxxxxxxx.com"){
is_value=0;
}
else if(urlPathSubstring4=="http://zzzzzzzzz.staging.xxxxxxxx.com"){
is_value=1;
}
else if(urlPathSubstring=="http://demo.qqqqqqqqq.com"){
is_value=2;
}else{
is_value=5;
}
}
[note, due to legal purposes I had to void out the URL in the if statements]
when I compile and do a trace, the domainName var spits out the location of the .swf and shows the is_value=5, which it should. Once I upload this to the demo server, the is_value is still showing up as 5, when it should be is_value=2.
I had originally started with externalInterface call and that was doing the same thing with the is_values. The code will run, it just seems like it might not be running through the substring and just defaults to the else statement.
Anything that y'all see or any suggestions?
Thanks!
