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/");
Don’t put it on any site. Just leave it on your computer, it’s protected :)
– Maniero
I don’t understand what you want to do. Protect from whom? From what? From where? How?
– bio
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
– edhue