//Protect your SWF files
About
This snippet prevents your swf from being played on another domain other than your own. If someone tries to run it on any other domain, they will be redirected to your domain. Put this code in the beginning of the first frame of your actions layer
//code start
var domain:String = "http://www.yourdomain.com" //enter your domain name here
if(_root._url.indexOf(domain) == -1 ){
getURL(domain, "_self");
}
//code end
Explanation
_root._url retrieves the url from where the Flash movie is being played. Of course if the flash movie is being played on your website then part of this string returned will contain www.yourdomain.com. On the other hand if it is not being played on your website then the value returned by _root._url will NOT contain your domain name i.e _root._url.indexOf(domain) == -1 will evaluate to true, and hence flash will redirect the browser to your domain.
Exta Security
Of course the above method will not prevent the determined from decompiling your swf and altering the above code. That is where obfuscators will come to your rescue. Click one of the links below to find one which suits you.
www.kindisoft.com
www.amayeta.com
This snippet prevents your swf from being played on another domain other than your own. If someone tries to run it on any other domain, they will be redirected to your domain. Put this code in the beginning of the first frame of your actions layer
//code start
var domain:String = "http://www.yourdomain.com" //enter your domain name here
if(_root._url.indexOf(domain) == -1 ){
getURL(domain, "_self");
}
//code end
Explanation
_root._url retrieves the url from where the Flash movie is being played. Of course if the flash movie is being played on your website then part of this string returned will contain www.yourdomain.com. On the other hand if it is not being played on your website then the value returned by _root._url will NOT contain your domain name i.e _root._url.indexOf(domain) == -1 will evaluate to true, and hence flash will redirect the browser to your domain.
Exta Security
Of course the above method will not prevent the determined from decompiling your swf and altering the above code. That is where obfuscators will come to your rescue. Click one of the links below to find one which suits you.
www.kindisoft.com
www.amayeta.com
Labels: Encrypt Flash, Protect your SWF files
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home