The Essential Guide to Flash CS4 AIR Development book is oriented to Flash developers interested in building desktop applications via Adobe AIR. You can order The Essential Guide to Flash CS4 AIR Development on Amazon or buy it on local bookstore.
Reading my previous AIR tutorials, you’ve worked with menus that are associated with tangible elements of your applications,
such as the following:
- Context menus that are activated on objects on the stage
- Context menus associated with icons in the system tray or dock bar
- Menus associated with windows and menus of the application itself
AIR applications also allow you to create pop- up menus . These are native menus like all
the other ones you’ve seen so far—the only difference is that pop- up menus aren’t natively
associated with any element on the interface of the application. It’s up to the developer to
define and implement the logic and the way in which a pop- up menu can be activated. An
AIR application can have any number of pop- up menus.
You can show a pop- up menu anywhere on the stage. It can be activated in the following
ways: if the user clicks a button, if the mouse rolls over any object, if the user presses
a combination of keys, and on any other condition you want for your application.
Activating pop- up menus
The NativeMenu class has the display() method to activate a pop- up menu. Every time
this method is called, the pop- up menu appears at the specified coordinates. The display()
method requires the three following arguments:
Destination stage : Specifies which stage has to display the pop- up menu. If the
AIR application is on only one NativeWindow- type window, the destination stage is
automatically the window that displays the application. If you’re making a multiwindow
application, you will have to specify the stage of the window you want to
display the pop- up menu on.
Coordinate (X axis) : Specifies the position on the X axis of the pop- up menu. This
coordinate specifies the position from the top left corner of the menu. The coordinate
will apply to the stage you’ve specified as a first argument of the function.
Coordinate (Y axis) : Specifies the position on the Y axis where you want to display
the pop- up menu. This coordinate specifies the position from the top left corner of
the menu. The coordinate will apply to the stage you’ve specified as a first argument
of the function.