GhostWire ContextMenu
This Flash component is a derivative of the GhostWire Menu (included in this set) and allows you to create "simulated" context menus in your applications. It provides an alternative solution to the traditional "right-click" context menu (in Flash applications, right-clicking brings up the Flash player's menu). With the GhostWire ContextMenu, you can allow users of your application to trigger a customized context menu by "long-pressing" (clicking on a spot and holding for a predefined time), or clicking on a spot with the ALT key held down at the same time.
Example
The following is an example of the ContextMenu component (filesize 15KB, 3KB icons):
* view XML file *
Note that the icons are for demo purposes only; they are not part of the product.
Features Viable "Right-Click" Alternative
The Flash player is not only a single-click platform, but also a single-button mouse platform. Considering that the player is meant to be ubiquitous (and Mac platforms traditionally has just single-button mouse), this should not come as a surprise. However, context menus play an important role in many applications. Implementing contextual menus in Flash applications has been difficult, due mainly to the fact that right-clicks bring up the Flash player's context (settings) menu. Although Flash player 7 now makes it possible to create customized context menu, it is nevertheless impossible to create a totally customized menu (and of course, requires the use of Flash MX 2004). The GhostWire ContextMenu component provides an alternative implementation of contextual menus in Flash applications. The menu is triggered by a "long-press" instead of "right-click". You can also allow users to trigger the menu by ALT-clicking (hold down ALT key and click). The following example enables the ALT key trigger:
Hotspot Area
The hotspot area (the area ready to receive context menu triggering click events) can be defined during authoring time. The component instance appears as a greenish box which you can scale and resize using the Transform tool - this defines the hotspot area and you can position it at the appropriate places. During runtime, the setSize method is available for resizing the hotspot area.
Menu Item Icons
Each menu item can be assigned its own icon. The component will attempt to load a movieclip symbol (exported in the library) and place it next to the label if the item's 'icon' property has been defined (with the symbol identifier). In the examples here, there are icons defined for the items in "New->Folder", "New->Shortcut", etc.
Built-in Handlers
The component has some built-in triggers - when the 'action' property of the component is set to 'GetURL', the 'data' property associated with a menu item is assumed to represent an URL and when the item is selected (clicked on), the URL will be loaded. When the 'action' is set to 'GotoAndPlay' or 'GotoAndStop', the 'data' property is assumed to be a frame number/label.
onSelect Events
The component has an onSelect event, which you can use to specify the action that should be executed when a menu item is selected by the user. This comes into play if you do not wish to use the built-in handlers (and set the 'action' property to 'Event').
Callback Events
Each item can also have a specific 'callback' method. If defined, this callback method supercedes the built-in handlers and onSelect event.
Snap to Pixel
The component snaps to pixel when published, ensuring that it looks crisp and sharp when the movie plays. Usually to achieve this, you need to ensure that you place your movieclips at integer coordinates (no decimal place) during authoring time. This is not necessary with GhostWire components, which will automatically snap to pixel when published. For example, if the component was placed at x coordinate 20.2, when published it will be placed at x coordinate 20.0 instead. In addition, the component also resizes itself to integer widths and heights.
Truly Skinnable
If the flexibility of the color settings still does not meet your requirments, you can change the 'skin' of the component. The following example shows an "XP" styled menu (in this case, the background of the menu has been changed):