PDA

View Full Version : drop down menu


vic one
07-19-2008, 08:58 AM
hi everyone.
i'll start by saying that a while back i took flash classes and enjoyed them alot.
i was always more interested in the scripting side of flash rather than its animation possibilities.

anyhow, i am working with a client who wants me to create a dynamic flash webpage for him. trouble is, none of my old stuff seems to work with as3.

i am trying to use the frame script:

btn1.on(mouseOver){
_root.btn1.menu_mc.gotoAndPlay(1);
}

and another one of those for a mouseOut event.

menu_mc is an animated drop down list.

perhaps it's been too long and i'm doing something wrong.

could someone please point me in the direction of a drop-down menu tutorial for AS3.
your help is appreciated as always!

theqman
07-19-2008, 08:14 PM
try:

import flash.events.*;

btn1.addEventListener(MouseEvent.CLICK, on);
function on(event:MouseEvent):void{
MovieClip(menu_mc).gotoAndPlay(1);
}

if that doesnt work post whats wrong here.

vic one
07-20-2008, 05:57 AM
thanks for that, it was helpfull.

however what should i do if i want the menu to appear when the mouse is over the button.
i've tried: mouseOver, rollOver, ENTER but none of them seem to work.

vic one
07-20-2008, 06:02 AM
ok, sorry for that, just looked deeper into flash help, turns out i need to use MOUSE_OVER
i have to say, i haven't ever come across that on AS2. is that just something new they've introduced?

also, can i use more than 1 event handlers for the same object?
how would i add a MOUSE_OUT event with the syntax.

thanks for all your help

theqman
07-20-2008, 07:29 AM
Yes you can add multiple event handlers. It would be something along the lines of:

import flash.events.*;

btn1.addEventListener(MouseEvent.MOUSE_OVER, on);
btn1.addEventListener(MouseEvent.MOUSE_OUT, off);
function on(event:MouseEvent):void{
MovieClip(menu_mc).gotoAndPlay(1);
}
function off(event:MouseEvent):void{
MovieClip(menu_mc).gotoAndPlay(2);
//whatever your code is
}