/** * @author Boy Carper - Toybot Interactive * @version 1.0 * * Class: FlashDenPreviewFileProtection * Description: This is a AS3 rewrite of the original AS2 class by Alex PICA. * The class prevents the theft of the preview files from flashden.net * * Usage: var loader:URLLoader = new URLLoader(); FlashDenPreviewFileProtection.addAlowedDomain("www.flashden.com"); FlashDenPreviewFileProtection.addAlowedDomain("flashden.com"); FlashDenPreviewFileProtection.addAlowedDomain("localhost"); FlashDenPreviewFileProtection.addAlowedDomain("127.0.0.1"); if(!FlashDenPreviewFileProtection.isStolenSWF(root)) loader.load(new URLRequest("pathtoyourxml.xml")); * * */ package com.toybot.flashden { public class FlashDenPreviewFileProtection { private static var _isPreviewFile:Boolean = true; private static var _allowedDomains:Array = new Array(); public static function isStolenSWF(_root:Object):Boolean { var i:int; for(i=0;i<_allowedDomains.length;i++) { if(String(_root.loaderInfo.url).indexOf(_allowedDomains[i])!=-1) return false } return true; } public static function addAlowedDomain(domain:String):void { _allowedDomains.push(domain); } } }