Vertical MenuBar Component
January 26, 2007 5 Comments
[dougmccune.com] Doug had posted a really good component in his blog – A Vertical MenuBar. This is really good as we now have one more navigation model other than the Accordion that can be docked on the left or right side of the application. check it out 🙂 . He also has a slick demo over there.
Someone on the Adobe Flex forum asked a question about being able to have vertical menus using a MenuBar component. The response from Peter Ent from Adobe was that no, Flex does not include a MenuBar component that can handle vertical menus, but feel free to make one yourself and post it <hint, hint>.
After I read that it felt like a challenge, so here’s the solution: a Vertical MenuBar component. It extends MenuBar and works the same way, except the Menu items are stacked vertically and the menus open up either to the left or to the right of the menu bar. I’ve included the full source, it uses two classes, one that’s an extension of mx.controls.MenuBar, and another one that’s an extension of mx.controls.menuClasses.MenuItemRenderer. You can specify whether you want the menu to open to the left or the right by using the new direction property of the new component.