AS3 swf Url test

Test if a swf is running from domains set as ‘legal’, eg: is it allow to run on a domain other than terrypaton.com?

Download zip

Here’s the code …

textBox.text = “TESTING WHERE SWF IS RUNNING FROM\n\nValid url’s are:\n\n”;
var legalLocations:Array = new Array(“file:”,”terrypaton.com”);
var swfRunningFrom:String = loaderInfo.url;
var isLegal:Boolean = false;
var c:int = legalLocations.length;

while (c- -) {
var test:int = swfRunningFrom.indexOf(legalLocations[c],0);
textBox.appendText (legalLocations[c]+”\n”);
if (test>-1) {
isLegal = true
;
}
}
textBox.appendText (“\nSwf running from one of these?:”+isLegal);