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 are using it in a game, place the code on enemy spawn code or in your character's walking code. If it's in a video, toss it in every 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.

You'll 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 a 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). Then go into the flash video you want to protect. All you need to do is tell your flash file to read that XML file and not run if it's on a banned site.

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.

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.