- import fl.motion.Color;
- import flash.geom.ColorTransform;
- * //Begin set up of the URLs//
- * import flash.events.MouseEvent;
- * //btn1//
- * var url_btn1:URLRequest = new URLRequest("http:www.flashden.net");
- * btn1.addEventListener(MouseEvent.CLICK, btn1Click);
- * function btn1Click(event:MouseEvent):void{navigateToURL(url_btn1);}
- * //btn2//
- * var url_btn2:URLRequest = new URLRequest("http:www.google.com");
- * btn2.addEventListener(MouseEvent.CLICK, btn2Click);
- * function btn2Click(event:MouseEvent):void{navigateToURL(url_btn2);}
- * //btn3//
- * var url_btn3:URLRequest = new URLRequest("http:www.youtube.com");
- * btn3.addEventListener(MouseEvent.CLICK, btn3Click);
- * function btn3Click(event:MouseEvent):void{navigateToURL(url_btn3);}
- * //btn4//
- * var url_btn4:URLRequest = new URLRequest("http:www.yahoo.com");
- * btn4.addEventListener(MouseEvent.CLICK, btn4Click);
- * function btn4Click(event:MouseEvent):void{navigateToURL(url_btn4);}
- * //End set up of the URLs//
- var btnClicked:String = "";
- var l:Label;
- var labelArray:Array = ["", "Home", "Download", "About us", "Contact"];
- var objArray:Array = new Array();
- btn1.addEventListener(MouseEvent.ROLL_OVER, manageOver);
- btn1.addEventListener(MouseEvent.ROLL_OUT, manageOut);
- btn1.addEventListener(MouseEvent.CLICK, manageClick);
- btn2.addEventListener(MouseEvent.ROLL_OVER, manageOver);
- btn2.addEventListener(MouseEvent.ROLL_OUT, manageOut);
- btn2.addEventListener(MouseEvent.CLICK, manageClick);
- btn3.addEventListener(MouseEvent.ROLL_OVER, manageOver);
- btn3.addEventListener(MouseEvent.ROLL_OUT, manageOut);
- btn3.addEventListener(MouseEvent.CLICK, manageClick);
- btn4.addEventListener(MouseEvent.ROLL_OVER, manageOver);
- btn4.addEventListener(MouseEvent.ROLL_OUT, manageOut);
- btn4.addEventListener(MouseEvent.CLICK, manageClick);
- init();
- function init():void
- {
- btnClicked = "btn1";
- var mc:MovieClip;
- var j:int;
- for(var i:int = 1; i<5; i++)
- {
- mc = this["btn"+i];
- mc.id = i;
- l = new Label(labelArray[i]);
- l.name = "label";
- l.x = Math.round(((mc.width*1.6) - l.width)/2);
- l.y = Math.round(mc.content.y+mc.content.height+l.height+5);
- l.alpha = 0;
- mc.addChild(l);
- objArray[i] = l;
- }
- Label(objArray[btn1.id]).alpha = 100;
- }
- function resetButtons():void
- {
- var len:int = objArray.length;
- for(var i:int = 1; i<len; i++)
- {
- Label(objArray[i]).setAlphaOut();
- }
- }
- function manageOver(pEvt:MouseEvent):void
- {
- resetButtons();
- Label(objArray[pEvt.target.id]).setAlphaIn();
- }
- function manageOut(pEvt:MouseEvent):void
- {
- resetButtons();
- if(btnClicked != "")
- {
- var mc:MovieClip = getChildByName(btnClicked) as MovieClip;
- Label(objArray[mc.id]).setAlphaIn();
- }
- }
- function manageClick(pEvt:MouseEvent):void
- {
- btnClicked = pEvt.target.name;
- }