The Flash and PHP Bible has been released! The book can be found on Amazon or wherever fine books are sold in your area.
The Flash and PHP Bible has a forum for quick support.
A simple method used to protect your Flash work. Note this is not 100% secure as it still suffers from the ability to rip apart a movie.
First off we use a simple actionscript to test the location of the movie.
var good_url:String = "http://www.yoursite.com";
var current_path:String = _url;
if (current_path.indexOf(good_url) == -1) {
// bad location
trace(_url);
unloadMovie(_root);
}
The problem with this code is the thief could simply add a query string to the url and the check will be valid. Not exactly the result we are looking for, so on to a more in depth process of validating the location.
This other "better" option will be in a function that will return a true/false result on validation. We do this so the code can easily be reused over and over again.
function check_location() {
// The good location
var good_url:String = "http://www.mysite.com";
// we add the correct domain as a query string, but notice it doesn't check out
var current_path:String = _url + "/chocolate/chip/type?q=www.example.com";
// now we pull apart the location to end up with a domain name piece
var domain = current_path.substring(current_path.indexOf('http://') + 7).split('/');
if(domain[0].indexOf(good_url) == -1) {
// bad location
unloadMovie(_root);
return false;
}
return true;
}
if(check_location()) {
trace("running on a good location");
}
As you can see this is a tougher check, but still suffers from the same limitation and that is Flash can be decompiled.
Well thats about it, now you should have a better understanding of how this all works.
©2004 - 2010 scriptplayground | Privacy Policy | Legal
Validate Site: XHTML CSS | Designed by: Matthew Keefe of mkeefeDESIGN