Copy link to clipboard
Copied
Hi
I'm stuck with this code for a drop down menu. The error message says It's expecting a right brace before the end of the program but as far as I can tell there's already one there... Any ideas are welcome!
import flash.events.Event;
import flash.display.SimpleButton;
addEventListener (Event.ENTER_FRAME,dropmenu1);
pages.stop();
var speed:Number=.3;
function dropmenu1(e:Event) {
if ((menu_1.mouseY<menu_1.height&&menu_1.mouseY>0) && (menu_1.mouseX<menu_1.width&&menu_1.mouseX>0)) {
menu_1.y-=(menu_1.y) *speed;
} else {
menu_1.y-=(55+menu_1.y) *speed;
}
function makebtn (btn:SimpleButton,frame:Number) {
btn.addEventListener (MouseEvent.CLICK,function() {pages.gotoAndStop (frame);});
}
makebtn (menu_1.CAT_strategy_btn,1);
makebtn (menu_1.stage_1_btn,2);
makebtn (menu_1.stage_2_btn,3);
Your first function is missing its ending brace
Copy link to clipboard
Copied
Your first function is missing its ending brace
Copy link to clipboard
Copied
Hi Ned. That works a treat, thank you for your help. Now the problem I'm having is that the drop down menu appears from the top of the frame. I have a header at the top so the buttons need to drop down a bit further down the screen.
menu_1.y-=(55+menu_1.y) *speed;
This code means that only the bottom button is visible and when I hover over it the rest drop into view. What I want is the same effect but just further down the screen (from 110 on the y axis to be exact.
Copy link to clipboard
Copied
I don't really understand your new problem, but if you need to have something be further down the screen, move it there. If that code is resposible for the placement, then adjust the values in it. If the conditional code that surrounds it dictates when different actions are taken, then adjusting the conditions might help as well.
Copy link to clipboard
Copied
Sorted it now. Thanks for your help.
Copy link to clipboard
Copied
You're welcome