First let me say that there are services that allow you to track your flash movie, but these services don't let you stop people from stealing them. What I'm going to show you is A) how to block a site from hosting your file (like the thieves at ebaum's world) and B) how to make your flash video 'call home' and when it does, check to see if it should be disabled. This trick relies on you having someplace to host a second swf, so if you can't do that, you'll have to find another way to do this. Let's get started.
The first way to stop a thief is to block their site from using your file. This can be achieved by placing code to detect their site and not allow you movie to play. This code should do the trick:
What the code does is check its location and if it matches "SiteToBlockHere.com", then it stops your movie. Place this code in a reoccurring movie clip for maximum effect. That way, the thief can't have your movie start at the frame after the stop code, thus defeating your code. If you using it in a game, place the code on enemy spawn code or in your hero's walking code. If it's in a video, toss it in ever 200 frames.
So that's the easy way to block 1 site from using your flash file, but what if you want something a bit better? You could always change the script so that it only allows 1 site so that it works on your site but not on other sites, but maybe you want to give copies to other people and you don't want to edit the code every time you let someone host it. Here's where having a file 'call home' is helpful.
What we're going to do is have your file load an XML file from your site to both track a thief and thwart them. First, you need to create the XML file. In your favorite text editor make a new file (you can create an empty action script file in flash) and insert the following:
You can change, add and remove the <banned site="" /> tags as needed. Save the file and call it something like 'banned.xml' and then upload it to your site (upload it anywhere you want, just know where you put it). Now that that's done, go into the flash video you want to protect. All you need to do is tell you flash file to read that XML file and not run if it's on a banned site. Simple, right? Well, actually, it is. Here's how you do it:
Be sure to change the last line to match the path to your ban file!
What the code does is 2 things. First 'checkIt' is set to the site that the flash video is playing from. If you were to put you movie at 'http://www.yoursite.com/videos/movie.swf', checkIt would be set to 'www.yoursite.com'. The next thing it does is load your banned.xml from your server and checks if it's on any of the banned sites. If it matches a banned site to its location, it'll halt the movie playback. Also, if it can't connect to your server it won't play.
This technique is simple, effective and super fast. Also, having you flash files call home is a nice way to track them. If you look at your server logs (or server stats) you can see who's requesting your banned.xml file, and track down people who have stolen your file(s). This allows you to ban sites as you find out about them and not block all sites which could block legitimate sites. A possible extension to this is adding a 'file' property to each 'banned' tag so that it reads <banned site="someOtherSite.com" file="myVideo" /> and have the videos detect if the ban rule applies to them or not. That way you can have your videos banned on different sites.
The only weakness to this code is that if someone hotlinks your movie, it'll still work as it'll be loading from your server. The only way to prevent that is to implement anti-hotlinking code on your server.
Enjoy and don't let thieves get rich off your flash files!
If you can't see the examples, try upgrading to the latest Flash Player and try the file again.
