Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Step 1: In order to load remote content from one domain into a SWF playing on another domain, you need to have
- // a file named "crossdomain.xml" located in the root of the remote server. So, for instance, if you are loading
- // your game from "http://mydomain.com/games/adventuregame/my_adventure_game.swf", you need to have a crossdomain file
- // located at "http://mydomain.com/crossdomain.xml"
- //
- // The crossdomain file should look like this: http://fekrack.net/crossdomain.xml
- // (You can just copy/paste that file onto your server, if you want)
- // Step 2: This allows your game SWF to access the stage, as well as other global variables
- try {
- Security.allowDomain("*");
- Security.allowInsecureDomain("*");
- } catch(err){
- }
- // Step 3: Figure out where the game is being hosted
- var url:String=this.loaderInfo.url;
- var domain:String="";
- if(url) {
- var urlParts:Array = url.split("/");
- if(urlParts.length>=3) {
- url = urlParts[2];
- urlParts = url.split(".");
- domain = urlParts[urlParts.length-2]+"."+urlParts[urlParts.length-1];
- } else {
- domain = "";
- }
- }
- if(String(domain)=="undefined.") domain="offline";
- trace("The game is being hosted at: '"+String(domain)+"'.");
- if(domain.indexOf("http://d.facdn.net")!=-1) {
- // DO SOMETHING IF THE GAME IS BEING HOSTED ON FURAFFINITY
- }
- // Step 4: Load your game
- var gameLoader:Loader = new Loader();
- gameLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
- gameLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
- gameLoader.load(new URLRequest("http://fekrack.net/toy_tester/toytester.swf"));
- addChild(gameLoader);
- function errorHandler(event:ErrorEvent):void {
- trace("An error occurred while loading your game: "+event);
- }
- stop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement