// clickTag code ------------------------------------------------------------
var url : String;
var btn : Sprite;
createBanner();
function createBanner() : void
{
btn = new Sprite();
with ( btn.graphics )
{
beginFill( 0x000 );
drawRect(0,0,stage.stageWidth,stage.stageHeight + 100);
endFill();
}
with ( btn )
{
alpha = 0;
buttonMode = true;
addEventListener( MouseEvent.MOUSE_UP, handleMouse );
}
addChild( btn );
if ( LoaderInfo(root.loaderInfo).parameters.clickTag )
{
url = String( LoaderInfo(root.loaderInfo).parameters.clickTag );
btn.addEventListener( MouseEvent.MOUSE_UP, handleMouse );
} else if ( LoaderInfo(root.loaderInfo).parameters.clicktag )
{
url = String( LoaderInfo(root.loaderInfo).parameters.clicktag );
btn.addEventListener( MouseEvent.MOUSE_UP, handleMouse );
}
// use this if you are adding other things to the displaylist dynamically,
// so that the button is always on top.
//stage.addEventListener( Event.ENTER_FRAME, bringBtnToTop );
}
function bringBtnToTop( evt:Event ) : void
{
addChild( btn );
}
function handleMouse( evt : MouseEvent ) : void
{
if ( url != null )
{
navigateToURL( new URLRequest(url), "_blank" );
} else {
trace("There was an error, or you have clicked the button in the Flash IDE.");
}
}