DIFFICULT *Menubar MX2004 Component*

LVL 1
gmailrulesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nishasrilankanCommented:
here is the working downloadable example.
http://philflash.inway.fr/menubar/menubar.html
0
gmailrulesAuthor Commented:
no, every one has a submenu.  the problem is getting an event listener to work with the menu items rather than the menu submenu items
0
nishasrilankanCommented:
With Menu component you cannot attach Event Handlers...that can be only achieved with MenuBarItem Class....MenuBarItem class has six event handlers..onPress, onRelease, onRollOver, onRollOut, onDragOver and onDragOut...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

gmailrulesAuthor Commented:
i think the menu component has a focusin even handler and menubaritem has a change handler
0
gmailrulesAuthor Commented:
how would i modify the class to add the change event handler to the menu buttons then?
0
nishasrilankanCommented:
Sorry...Menu has following event handlers..
Event summary for the Menu class

Menu.change
 Broadcast when a user causes a change in a menu.
 
Menu.menuHide
 Broadcast when a menu closes.
 
Menu.menuShow
 Broadcast when a menu opens.
 
Menu.rollOut
 Broadcast when the pointer rolls off an item.
 
Menu.rollOver
 Broadcast when the pointer rolls over an item.
 


///Actually Change event handler is already there
0
gmailrulesAuthor Commented:
yeah but i cant get it to work, and from what i can tell from searches other people are having the prob as well
0
nishasrilankanCommented:
Sorry...I dont think that can be implemented..
0
negatyveCommented:
*aware: hack* :)

var listener:Object = new Object();
listener.change = function(evt:Object):Void
{
     trace(evt.menuItem.parentNode.attributes.label);
};

var menu:mx.controls.Menu = menu_mc.addMenu("asia");
menu.__activator.oldOnPress = menu.__activator.onPress;
menu.__activator.onPress = function()
{
      this.oldOnPress();
      trace("MENU 1");
};
menu.addEventListener("change", listener);
menu.addMenuItem("india");
menu.addMenuItem("china");
menu.addMenuItem("pakistan");

var menu:mx.controls.Menu = menu_mc.addMenu("europe");
menu.__activator.oldOnPress = menu.__activator.onPress;
menu.__activator.onPress = function()
{
      this.oldOnPress();
      trace("MENU 2");
};
menu.addEventListener("change", listener);
menu.addMenuItem("denmark");
menu.addMenuItem("britain");
menu.addMenuItem("spain");
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gmailrulesAuthor Commented:
Sorry I took so long to get back to this question.  Thanks a lot for the anwser :D
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.