Developer Network Home  Help 

YDN Flash Developer Center Astra Flash Components MenuBar
Flash Developer Center

ASTRA MenuBar

MenuBar is a UI component that renders hierarchical data as a row of buttons with nested menus that can be used to provide convenient access to various application functionality.

Getting Started: MenuBar for Flash CS3

Similar to other Flash components, you can create an MenuBar by placing an instance of MenuBar on the stage or by using ActionScript to create an instance dynamically.

Initializing a MenuBar on the Stage

The easiest way to create a MenuBar is to drag it from the Components panel to the stage. This will immediately create a MenuBar instance and add it to the display list. To populate the MenuBar and its Menus, you'll need to use ActionScript. So we'll show how to do that.

Screen capture of Alert

To see a live example, please install Adobe Flash Player version 9 or higher.

Download the FLA file.

Create some xml and assign it to the menubar's dataProvider

Initializing a MenuBar with ActionScript

To include a MenuBar in your application with ActionScript, you must first add the MenuBar component to your library. You can do so by dragging it from the Components panel directly to the library, or by dragging an instance to the stage, and immediately removing it (it will stay in your library). Additionally, you need to import the following class for use in your class or frame script.

The class com.yahoo.astra.fl.controls.MenuBar is the main required class for a MenuBar control.

Create an xml object as you did in the previous example.

Instantiate the MenuBar instance and assign the xml to it's dataProvider property.

Download the FLA file.

For additional topics, please read Using MenuBar, or take a look at the Examples section for functional demonstrations. The ActionScript 3.0 Class Reference contains full details on every property, method, and style available to the MenuBar component.