PDA

View Full Version : Drop Down Menu Question


Jackwrench
06-04-2007, 08:39 PM
I am relatively new to flash work and I am trying to set up a drop down menu. I have it set up now so that when you roll over a button, it skips to the frame in the movie that contains the animation for the menu that drops down, rather than building the whole menu into a single instance or button.

The problem with doing this, I've discovered, is that when you roll out, the menu does not go away until you roll over another option on the menu, meaning that the drop down stays open unless you open a new one.

I tried creating a transparent shape over the top of the whole menu with a command to return to the first frame of the movie on roll out, but now the problem becomes that you cannot click on any of the buttons because there is a shape over those objects. If I put the transparent shape behind the menu, then whenever you roll onto one of the menu options, the movie resets because you are rolling out on the transparent shape.

Is there a way that I can set up the menu so that when you roll out, the menu closes without having to open a new one without making the menus invididual instances and/or buttons? Please let me know if I am being unclear or if I need to provide more info as I'm new to posting on these forums.

Thanks in advance for the assistance!

-J

atomic
06-05-2007, 12:29 AM
Try this...

neo-n27
10-18-2007, 04:50 PM
Hi, I post my code, I did alone. There is a MC named bar0 on the Scene and this same bar (button) is linked in Library as bar.

My wish was to:
- attach multiple bar's from Library to the one on the Scene,
- slide all of them down from the main bar, when it's clicked,
- rollover on some menuitem on the Scene, which can't cause close() function to be launched

//----- CODE

odstep=0;
ilosc=5;
speed=3;


var napisy = new Array('menu','element 1','element 2','element 3','element 4','element 5');

function open() {

for (i=1;i<=ilosc;i++) {
this.attachMovie('bar','bar'+i,i);
this['bar'+i]._y=bar0._y;
this['bar'+i]._x=bar0._x;
this['bar'+i].endY = bar0._y + i*(bar0._height+odstep);

this['bar'+i].onEnterFrame = function() {
this._y += (this.endY-this._y)/_root.speed;
}

this['bar'+i].createTextField("napis", getNextHighestDepth(), 3, 2, 80, 20);
this['bar'+i].napis.html = true;
this['bar'+i].napis.selectable = false;

this['bar'+i].napis.htmlText="<FONT FACE='Verdana' SIZE='11' COLOR='#000000'>"+napisy[i]+"</FONT>";
}
}

function close() {
for (i=1;i<=ilosc;i++) {
this['bar'+i].onEnterFrame = function() {
this._alpha -=10;
}
this['bar'+i].napis._visible=false;
}
}


//-------------------

function buttonStates(n) {

this[n].state = 0;

this[n].onPress = function() {
this.state = !this.state;
};

this[n].onRelease = function() {
if (this.state) {
open();
} else {
close();
}
};
}

this.buttonStates(_root.bar0._name);



As you can see above, all works fine but one thing. The negation this.state[n]=!this.state[n] causes, that when I launch open() at the program start, I can click item in menu (the hand shows up), but when I click main menu, and the want to rollover subitem in that menu, the hand is gone, even when I test it, launching open() twice, to check if something was wrong.

So at the end, something is wrong witch switch on/off function, especially with the negation, but what?

I used Flash 8 Professional, below is an attachement with the application. Be free to use it, like you want.

Maybe, you will find simpliest way of implement on/off and select functions.

I'm exhausted with my tiny little problem. Maybe you have an idea how to overcome or reroute this?

neo-n27
10-18-2007, 04:53 PM
... and some example, I' ve created in F8 Professional.

neo-n27
10-20-2007, 05:38 PM
Could you post here the attachement with your Flah animation? I'll try to solve it in 24h. C'ya.

Alexus
10-22-2007, 11:24 AM
Jackwrench, try this Open Source menu (http://flashmenulabs.com/opensource), rollOut event works properly :)

sam2
10-29-2007, 07:50 PM
Try this...

how do i make a submenu with this drop down menu??:confused:

atomic
10-29-2007, 08:41 PM
You mean a submenu of one of the items in the drop menu?

sam2
10-29-2007, 10:24 PM
ya.
how do i do that?

skee
11-19-2007, 03:29 PM
Alexus,
I can't seem to get that flash menu from flashmenulabs you mentioned to work. I downloaded the whole zip, open up the .fla in Flash, try to preview movie and a blank screen comes up. I have all the components but I 2 errors

**Error** Scene=Scene 1, layer=actions, frame=1:Error opening include file frame1st.as: File not found.

**Error** Symbol=menu_item_prototype, layer=Layer 1, frame=1:Line 1: The class or interface 'CMenuItem' could not be loaded.

Total ActionScript Errors: 2 Reported Errors: 2

Both the CMenuItem and frame1st.as files are in the same folder. Any thoughts? Also, is there a version of that .fla that does not call out to external as files?
thanks,
Skee