views:

770

answers:

2

Hi

I'm making a right toolbar with different buttons on it. When i rollover it, it slides inside the view and when i rollout it slides out of the view almost 90%. each button on it also has some rollOver/Out event listeners. Problem is, when i rollover on any button, then the rollout event of the container(toolbar) get dispatched and toolbar hides itself.

Is there any way to keep hide/showing on rollover/rollout the toolbar, and also justify with buttons over the toolbar?

Thanks

A: 

If I had this problem in Flash I listened to MouseMoved event and checked the x and y of the mouse. If you use this technique for your toolbar, you can go ahead and use the RollOver/Out for the buttons. But maybe you can solve it easier in Flex which I don't know of.

Here's your solution I think, with the mouseChildren property.

Lieven Cardoen
thanks, i also did it using mouseX-MouseY position calculation, but i want to confirm if it is the best way to do that. and i think it is :)
Max
+3  A: 

If you're trying to stop an EventListener from being called (and it seems like that is your issue), the easiest way is to call

event.stopImmediatePropegation()

You may have to couple it with adding a priority parameter to addEventListener:

                                                        // capture
target.addEventListener( MouseEvent.CLICK, clickHandler, false, 1000 );
                                                                // priority

The trick is to make sure that you have the MenuButtons use a higher priority than the Menu itself, that way you can prevent the Menu from listening to the Menu Buttons.

Christopher W. Allen-Poole
I don't think that's his question.
Lieven Cardoen
I'm not sure if it is his question, but I think that it is the root of the problem he is trying to solve.
Christopher W. Allen-Poole
Thanks Christopher :)
Max