It is very easy to make flash restricted to a single Domain.
it involved a vs.as file and a fla file.
Logic
first it need to get the current url of website and get the domain from the url by some string operations(slice, indexOf).
Then check that sliced string is the Domain name.
if not unload all movie from flash
Code
vs.as:
function validateServer(srvr)
{
http="http://";
www="http://www."
i1=_url.indexOf(http)
if(i1==-1)
{
i1=0;
}
else
{
if(_url.indexOf(www)!=-1)
{
i1=i1+www.length;
}
else
{
i1=i1+http.length;
}
}
i2=i1+_url.slice(i1,_url.length).indexOf("/");
url=_url.slice(i1,i2);
if(url!=srvr)
{
_root.createEmptyMovieClip("block_mc",_root.getNextHighestDepth());
_root.block_mc.beginFill(0xFFFFFF,100)
_root.block_mc.moveTo(0,0);
_root.block_mc.lineTo(Stage.width,0);
_root.block_mc.lineTo(Stage.width,Stage.height);
_root.block_mc.lineTo(0,Stage.height);
_root.block_mc.lineTo(0,0);
_root.block_mc.endFill();
_root._visible=false;
_root.unloadMovie();
_root._height=0;
_root._width=0;
getURL("javascript:alert('This flash only work in " + srvr+"')");
}
}
include vs.as to your flash movie
write following code to first frame of _root timeline
#include "vs.as"
validateServer("ipixhost.com");
Download Zip File


0 comments:
Post a Comment