Blog Archive

Thursday, March 11, 2010

Domain Validation using Flash ActionScript2

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

Friday, September 18, 2009

Awesome Rounded corner css hover button with single background image

Here is a simple Rounded corner css navigation button.

1)Add background image
download below jpg image to your images folder.



2)Add html code
Add below html code to your web page where you want to show the navigation bar


<ul class="nav">
<li><a href="#"><span> Home </span></a></li>
<li><a href="#"><span> Our Services </span></a></li>
<li><a href="#"><span> Sitemap </span></a></li>
<li><a href="#"><span> Contact Us </span></a> </li>
</ul>




3)Add CSS Styles
Add below css styles to your stylesheet files or to your html page

ul.nav{
padding:0;
margin:0;
}
ul.nav li{
float:left;
list-style-type:none;
margin-left:5px;
}
ul.nav li a:link,ul.nav li a:visited{
text-decoration:none;
font-weight:bold;
font-size:14px;
color:#669933;
height:35px;
display:block;
padding-left:15px;
cursor:pointer;
float:left;

}
ul.nav li a:hover{
text-decoration:none;
font-weight:bold;
font-size:14px;
color:#FFFFFF;
background:url(images/nag_bg.jpg) no-repeat;
}
ul.nav li a:hover span{
background:url(images/nag_bg.jpg) no-repeat right;
}
ul.nav li span{
display:block;
height:35px;
padding-right:15px;
line-height:30px;
float:left;
}

download zip file