flexlib :: library Documentation | All Packages | All Classes | Index | Frames No Frames |
VerticalMenuBar

Package | flexlib.controls
Class | public class VerticalMenuBar
Inheritance | VerticalMenuBar mx.controls.MenuBar

A VerticalMenuBar control defines a vertical, top-level menu bar that contains one or menu items, just like the horizontal MenuBar control.

For information and an example on the attributes that you can use in the data provider for the VerticalMenuBar control, see the Menu control.

MXML Syntax Show MXML Syntax
Hide MXML Syntax

The `<flexlib:VerticalMenuBar>` tag inherits all of the tag attributes of its superclass, and adds the following tag attributes:

    	  <flexlib:VerticalMenuBar
    	    Properties
    	    direction="left|right"
    	 	  />

Default MXML Property `dataProvider`

See also

mx.controls.MenuBar

Public Properties

| Property | Defined By
--- | --- | ---
|  | direction : String Specifies which direction, either left or right, the menu opens. | VerticalMenuBar

Public Methods

| Method | Defined By
--- | --- | ---
|  | VerticalMenuBar() Constructor | VerticalMenuBar
|  | getMenuAt(index:int):Menu [override] Overridden to allow us to display the Menus to the left or right of the MenuItems. | VerticalMenuBar

Protected Methods

| Method | Defined By
--- | --- | ---
|  | measure():void [override] Changed to calculate based on vertical layout. | VerticalMenuBar
|  | updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void [override] Changed to calculate based on vertical layout. | VerticalMenuBar

Public Constants

| Constant | Defined By
--- | --- | ---
|  | LEFT : String = left [static] There are two possiblities for direction: left or right. | VerticalMenuBar
|  | RIGHT : String = right [static] There are two possiblities for direction: left or right. | VerticalMenuBar

Property Detail

direction | property

`direction:String`

Specifies which direction, either left or right, the menu opens.

This can be set via MXML or Actionscript. The direction will take effect the next time a menu item is clicked.

The default value is `"right"`.

Implementation
`public function get direction():String`
`public function set direction(value:String):void`
Constructor Detail

VerticalMenuBar | () | Constructor

`public function VerticalMenuBar()`

Constructor

Method Detail

getMenuAt | () | method

`override public function getMenuAt(index:int):Menu`

Overridden to allow us to display the Menus to the left or right of the MenuItems.

We're overriding getMenuAt for two reasons. First, we set a custom itemRenderer for the menu if we're supposed to be facing left. Second, we add a listener that gets executed when the menu is shown. The secret to what we're doing is we're repositiong the menu only after it has been positioned originally by the mx.controls.MenuBar class. This allows us to not have to override a ton of private methods of the MenuBar class. The fundamental problem with extending MenuBar for our purposes is that the showMenu method is private. If showMenu was protected we might be able to just override that and specify our own coordinates for where to place the menu. But instead, we do it a sneaky way and try to move the Menu the instant it gets shown.

Parameters

| `index:int`

Returns

| `Menu`

measure | () | method |

`override protected function measure():void`

Changed to calculate based on vertical layout. Pretty much the same code as in MenuBar, but instad of using the X and width properties, now we're using Y and height.

updateDisplayList | () | method |

`override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void`

Changed to calculate based on vertical layout. Pretty much the same code as in MenuBar, but instad of using the X and width properties, now we're using Y and height.

Parameters

| `unscaledWidth:Number`
| `unscaledHeight:Number`

Constant Detail

LEFT | Constant

`public static const LEFT:String = left`

There are two possiblities for direction: left or right. Here we define these two constants that you should use in your AS code to change the direction of the VerticalMenuBar. So to change the direction the code would be something like: menubar.direction = VerticalMenuBar.LEFT;

RIGHT | Constant |

`public static const RIGHT:String = right`

There are two possiblities for direction: left or right. Here we define these two constants that you should use in your AS code to change the direction of the VerticalMenuBar.

Mercredi Juillet 4 2012, 09:36 PM +02:00