How to protect swf file from running on other domains?

Asked

Viewed 86 times

2

Protect a swf file by Actionscript 3.0?

I know there’s a Security.allowDomain("www.example.com"), but it only serves to be able to receive data from the domain that is in parentheses, if I’m not mistaken. Someone knows some other way by as3?

Thank you!

  • Don’t put it on any site. Just leave it on your computer, it’s protected :)

  • I don’t understand what you want to do. Protect from whom? From what? From where? How?

  • There is no code in as3 that makes it kind for the swf to work only on 1 certain domain ? Kind for the person when picking up my swf and directly on her website will not work only if she decompile and change the domain

1 answer

0


To make the SWF obsolete in other domains, you can use the command SecurityDomain.currentDomain.domainID. This feature returns a unique id of the swf hosting domain, through the object Singleton Securitydomain. Thus, you can check whether the file is in the predefined domain.

if(SecurityDomain.currentDomain.domainID == "0A806C77AC090336AB036671325939AA720863AE7F89194428B0751457893451") {
      //iniciar código;
}

Another way is you use Security.pageDomain, this method returns the String of the domain swf is hosted on.

if(Security.pageDomain == "http://www.seusiste.com.br/") {
    //iniciar código;
}

To prevent other swfs from being able to load your swf, you need to use precisely the code you quoted Security.allowDomain(). Passing as parameter the domain that is able to import your swf.

Security.allowDomain("http://www.seudominio.com.br/");
  • That’s just what I’ve been wanting so much thank you !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.