Reputation: 95
I am working in Flex 4.6 web application. I have a menubar when i click on that submenu is being open after that it works on mouse over. Now the problem is I want it on mouse over when i over the mouse on menubar submenu should open not onclick. How can i do it. Please give me your advice.
Thanks Bikrant Singh
Upvotes: 0
Views: 128
Reputation: 36
You can use MOUSE_OVER event this way
<mx:MenuBar id="menuBar" creationComplete="onMenuComplete(event)" />
private function onMenuComplete(event:FlexEvent) {
menuBar.addEventListener(MouseEvent.MOUSE_OVER, onMenuRollOver, true);
}
private function onMenuRollOver(event:MouseEvent):void {
if (event.target is IMenuBarItemRenderer && menuBar.selectedIndex == -1) {
var index:int = IMenuBarItemRenderer(event.target).menuBarItemIndex;
menuBar.selectedIndex = (index == 0) ? 1 : 0;
}
}
But if you want to hide it too, you should use MOUSE_OUT event
Upvotes: 1