News - Happenings at iGeeks

April 5th, 2004

prevent swf from playing locally other than http://

Have you been worried that people are downloading your swf from cache and viewing it offline
Have you been worried about your question and optional answers are being viewed offline ( elearning project)

Here I have little piece of code, which should prevent users from viewing the page.

_global.fx_online = (this._url.subStr(0,7) == “http://”);
if(fx_online){
}else{
_root._visible=0;
}
this code need to be placed in the first frame of your movie, if you are using loadmovie, then the clip which you are loading needs to have this piece of script.

I still don’t assure you that all contents are safe, as you all know there are decompilers available, I am just trying to make things little hard.

Vinod

Comments

Nice post Vinod, it’s important to note however that this doesn’t prevent the swf from being run on a local server.

If you’re just hosting the swf on one location this piece of code is much more secure:

if(_url != “http://www.mysite.com/myfile.swf” ;) {
_level0.unloadMovie();
}