Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : rollover, rollout and telltarget functions


Tim Perrett
6/12/2004 3:42:56 PM
can any one help me with the codeing for this particular problem. im trying to
make a menu (not disimilar than the one at the top of the page) ive been told
that rollover, rollout and telltarget functions are the answer but im not sure
how to go about exatly implementig them, im running Flash MX, not 2004.

thanks to anyone who can help me!!!

Tim
MechaFlasher
6/14/2004 11:16:05 PM
I don't know about telltarget, never used it, but if I were to make a menu I'd
do it something like this:

I'd make a movieclip named 'menu' or something like that, and inside I'd have
a series of button objects, one for each menu entry (each with a textfield
inside). Then for each button you would set the onRelease method to handle any
clicks and do whatever it's supposed to do when a user makes a selection.
There's tons of variations and ways to do what you're asking, but that's the
easiest and quickest way I can think of to get you off on the right track. If
you don't use button objects and use movieclips instead then you would have to
set onRollOver and onRollOut and other methods that the button object has built
in.
Tim Perrett
6/15/2004 10:25:21 AM
hey, thanks for the advice, but i my only probem is the like the menu at the
top of the screen, when the user roll's over, on a button (developers for
example) it displays a further menu. this is the code in the flash index of how
to use a rollOut function but im not sure exactly how to implemnt the code...

Description

Event handler; invoked when the pointer rolls outside of a button area.

You must define a function that executes when the event is invoked.

Example

The following example defines a function for the onRollOut method that sends a
trace to the Output window.

myButton.onRollOut = function () {
trace ("onRollOut called");
};

so how can i code this onto the numerous buttons so that they roll out of the
button area, the menu that its displays stays visivle? and is the sencondary
menu loads of buttons within yet another movie clip?

MechaFlasher
6/15/2004 8:52:35 PM
Not sure I understand exactly, but yes each menu level would be a separate
movie clip with buttons for each menu selection inside. In the onRollOver for
each button it would make visible the next submenu for that particular
selection you rolled over. (example, roll over movieclip button for menu
selection 'Developers', make visible another movieclip with subselections).
Then in the onRollOut method for each button you would do a test to see where
the user's mouse is. Depending on which menu level the mouse is over, you
would keep every level previous to that one visible and every level after it
you would set to invisible. That's really generic and probably confusing, but
a good menu system is probably one of the harder things to build on your own.
There is a movieclip property called trackAsMenu that is supposed to help in
building these kinds of menus, but I've never used it myself. Hope that helps a
tiny bit anyway!
Tim Perrett
6/16/2004 2:43:18 PM
sorry, im still confussed. for arguments sake, ive roughd out a general test
structure in the link below. see how as the mouse move out of the first option,
the sub menus disaaper? how can i rectify this?

http://www.digitalbrain.com/frotimothyp99/web/menu%20butt.swf

what u rkon the problem is? i just dont know how to code the rollOut
function?????
MechaFlasher
6/16/2004 8:54:44 PM
I see now...that's kinda what I was thinking, but I'm not the greatest at
explaining things - that's why I'm not a teacher!

if you attach the fla up of that example I can look at it. Looks to me like
there must be code in that onRollOut that's turning the submenu invisible, I
don't see why else it would just disappear like that on it's own. A couple
ideas I would try:

1. I would try putting in a short timer that waits for a second, then tests
for where the user's mouse is. If the mouse if over the submenu or the main
button, then leave it displayed, but if the mouse is not over the submenu then
make it invisible.

2. The other way would be to put a catch-all clip behind the main button and
the submenu, so you wouldn't use the onRollOut handler at all. Instead, on the
catch-all you would use the onRollOver handler to make the submenu invisible.
I've used that way before and it's easier, but I've had cases where the user
moves the mouse so fast that the onRollOver doesn't trigger and the submenu
stays up when it shouldn't - you just have to make sure enough of the catch-all
surrounds the button and submenu to allow time for the handler to trigger.

Tim Perrett
6/20/2004 4:14:28 PM
heres the FLA file for that menu structure

cheers

Tim Perrett
7/26/2004 6:28:40 PM
hey boys and girls,

feel a bit wierd answering my own question but i thought i better, just in
case there is n e one out there havin similar difficulties!!!

make a MC, make ur buttons, then make the rollover state, and use a piece of
scrip that maove the MC to the frame where the over state is located with the
further buttons. then use a _root clause to navigate or dynamicly load in level
0. use a large button that is alpha 0% that resets the MC to the "up" frame.
this is soooo simple i cant belive i ever had problems!!! lol

cheerio :D
AddThis Social Bookmark Button