A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    Protecting my flash embed

    Hello,

    New to the forum and a "here-and-there" user of flash whenever a project commands it. I was wondering if you guys know the best way to protect my flash embed from being stolen and used on another site.

    Basically we have a unique project that we don't want people embedding all on their site and have to come to us to view it. Last time we launched a similar project it went viral, but to the point that people were embedding it on their site having us lose vital page views. We credit our work and do link to our page through the project but I want us to be the only place it can be viewed.

    I don't know if this is possible in flash or actually how I embed it. I use a content management system for our site that does not play friendly with certain codes (javascript for example) but open to any ideas.

    Thanks!

  2. #2
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    744
    You can check to see what page the swf is embedded in with root.loaderInfo.url
    Code:
    if(root.loaderInfo.url!= "http:mywebsite.com"){
       //do something else;
    }

  3. #3
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,770
    Taken from THIS THREAD, use this code on Frame 1:

    - Actionscript 2.0 -

    Code:
    // say, if your website's full URL path is:
    // http://www.mywebsite.com/
    // only type your website's name + the country code, like below
    yourWebsite = "mywebsite.com";
    
    myURL = flash.external.ExternalInterface.call("function(){ return window.location.href; }");
    basename = myURL.split("/");
    
    if(basename[2] != yourWebsite && basename[2] != "www."+yourWebsite){
    	i = 0;
    	while(i == 0){
    		// crash
    	}
    	unloadMovie(this);
    }
    - Actionscript 3.0 -

    Code:
    // say, if your website's full URL path is:
    // http://www.mywebsite.com/
    // only type your website's name + the country code, like below
    var yourWebsite:String = "mywebsite.com";
    
    var myURL:String = flash.external.ExternalInterface.call("function(){ return window.location.href; }");
    var basename:Array = myURL.split("/");
    
    if(basename[2] != yourWebsite && basename[2] != "www."+yourWebsite){
    	var i = 0;
    	while(i == 0){
    		// crash
    	}
    	stage.removeChild(root);
    }
    It's the same as rynoe's, but a bit extended. For simplicity, use his code, but note that loaderInfo.url will not only return the URL to your website, but if it's located inside a sub-folder or something, then that will be included in the URL.
    17 Years old boy, who loves the Computer Technology

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  4. #4
    _____________ fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    401
    Hi,

    This will also decpiher the url it is being played from, no matter which directory it is in.

    PHP Code:
    var OurSite:String "http://www.oursite.com";
    if(
    _root._url.indexOf(OurSite) == -){
        
    getURL(OurSite"_self");

    any of these still do not prevent anybody from decompiling your work, for that you will need some form of obfuscator software

    http://www.kindi.com/

  5. #5
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    552
    yes, with the right tool it is very (and I mean VERY) easy to replace urls in all the examples above without any decompiling/recompiling mess. so if you have "mywebsite.com" in plain text there, no obfuscation software will help you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts




Click Here to Expand Forum to Full Width


HTML5 Development Center