I have a flash application that I am going to put up on my website shortly. I want to be able to "lock it" to the site to prevent:
While allowing:
There are commercial applications that cost hundreds of dollars to perform this task, but I'm pretty sure it can be done with:
root.loaderInfo.url
Somehow. Does anyone out there know how to go about doing this? My biggest concern is the iFrame prevention, as when sites steal flash they usually just iframe to your own site to save themselves the bandwidth costs.
I'm using Flex SDK (not the Flash IDE) so some pure AS3 code will do the trick for me.
This code will report back the loading URL. You can use it in your main loader to show an unauthorized message or not load at all if it doesn't match what you expect:
public static function Domain(root:Sprite):String {
var currentDomain:String = root.loaderInfo.url.split("/")[2];
var fqdn:Array = currentDomain.split(".");
var rdi:int = 1;
var tli:int = 2;
if (fqdn.length == 2) {
rdi--;
tli--;
}
return fqdn[rdi] + "." + fqdn[tli];
}