Thursday, December 23, 2010

Adobe flash CS5 -Actionscript 3.0 -Create a Drop Down Menu and Linking It


The source code template can be downloaded from:
http://www.developphp.com/Flash_tutorials/show_tutorial.php?tid=21
After download Drop_Down_Menu.fla, open it in flash CS5.
  Double click it and go to drop_down_menu.
Under Script layer, press F9 and modify the actionscript source code to add your link:
// ROLL_OVER fuctions for all 3 main buttons
function main1Over(event:MouseEvent):void {
gotoAndPlay("down1");
}
function main2Over(event:MouseEvent):void {
gotoAndPlay("down2");
}
function main3Over(event:MouseEvent):void {
gotoAndPlay("down3");
}
// Event Listeners for all 3 main buttons
mainBtn1.addEventListener(MouseEvent.ROLL_OVER, main1Over);
mainBtn2.addEventListener(MouseEvent.ROLL_OVER, main2Over);
mainBtn3.addEventListener(MouseEvent.ROLL_OVER, main3Over);

//for HOME button link
function main1Click(event:MouseEvent):void {
var main1URL:URLRequest = new URLRequest("http://www.sciencegadget.com/");
navigateToURL(main1URL, "_blank");
}
mainBtn1.addEventListener(MouseEvent.CLICK, main1Click);
//for home sub-button under HOME button link
function btn1sub1Click(event:MouseEvent):void {
var main1URL:URLRequest = new URLRequest("http://www.sciencegadget.com/");
navigateToURL(main1URL, "_blank");
}
btn1sub1.addEventListener(MouseEvent.CLICK, btn1sub1Click);
result:(only link for home)


No comments:

Post a Comment