flash.uiMouseCursorData The MouseCursorData class lets you define the appearance of a "native" mouse cursor.Defines a custom mouse cursor. Object The MouseCursorData class lets you define the appearance of a "native" mouse cursor.

To display the cursor, use the Mouse.registerCursor() function. To return control of the cursor image to the operating system, call Mouse.unregisterCursor(). Call Mouse.supportsNativeCursor to test whether native cursors are supported on the current computer.

The maximum cursor size is 32x32 pixels.Transparency is supported on most operating systems.

A native mouse cursor is implemented directly through the operating system cursor mechanism and is a more efficient means for displaying a custom cursor image than using a display object. You can animate the cursor by supplying more than one image in the data property and setting the frame rate.

The cursor is only displayed within the bounds of the stage. Outside the stage, control of the cursor image returns to the operating system

The following example creates and displays a spinning arrow for the mouse cursor.

The example uses the drawing commands available through the Graphics class to create eight, rotated images of an arrow. These images are pushed into a vector and assigned to the data property of the MouseCursorData object. (Note that you can also use prerendered bitmap images for your cursors.)

package { import flash.display.Sprite; import flash.display.Shape; import flash.display.BitmapData; import flash.display.GraphicsPath; import flash.ui.MouseCursorData; import flash.ui.Mouse; import flash.geom.Matrix; public class MouseCursorDataExample extends Sprite { //Graphics path data for an arrow private var cursorPoints:Vector.<Number> = new <Number>[0,8, 16,8, 16,0, 24,12, 16,24, 16,16, 0,16, 0,8]; private var cursorDrawCommands:Vector.<int> = new <int>[1,2,2,2,2,2,2,2]; public function MouseCursorDataExample() { var mouseCursorData:MouseCursorData = new MouseCursorData(); mouseCursorData.data = makeCursorImages(); mouseCursorData.frameRate = 1; Mouse.registerCursor( "spinningArrow", mouseCursorData ); Mouse.cursor = "spinningArrow"; } //Returns a Vector containing 8 cursor images private function makeCursorImages():Vector.<BitmapData> { var cursorData:Vector.<BitmapData> = new Vector.<BitmapData>(); var cursorShape:Shape = new Shape(); cursorShape.graphics.beginFill( 0xff5555, .75 ); cursorShape.graphics.lineStyle( 1 ); cursorShape.graphics.drawPath( cursorDrawCommands, cursorPoints ); cursorShape.graphics.endFill(); var transformer:Matrix = new Matrix(); //Rotate and draw the arrow shape to a BitmapData object for each of 8 frames for( var i:int = 0; i < 8; i++ ) { var cursorFrame:BitmapData = new BitmapData( 32, 32, true, 0 ); cursorFrame.draw( cursorShape, transformer ); cursorData.push( cursorFrame ); transformer.translate(-15,-15); transformer.rotate( 0.785398163 ); transformer.translate(15,15); } return cursorData; } } }
flash.ui.Mouse.cursorAIR Cookbook: Native Mouse cursor for Flash Player 10.2+MouseCursorData Creates a MouseCursorData object.Constructor. Creates a MouseCursorData object.

To display the cursor, call the Mouse.registerCursor() function.

flash.ui.Mouse.registerCursor()
data A Vector of BitmapData objects containing the cursor image or images.The mouse cursor image or images. A Vector of BitmapData objects containing the cursor image or images.

Supply more than one image and set the framerate property to animate the cursor.

The maximum cursor size is 32x32 pixels.

frameRate The frame rate for animating the cursor.NumberThe mouse frame rate. The frame rate for animating the cursor.

Suppy more than one image in the data property and set the frame rate to a value greater than 0 to animate the cursor. The cursor frame rate may differ from the current SWF frame rate.

hotSpot The hot spot of the cursor in pixels.flash.geom:PointThe cursor hot spot. The hot spot of the cursor in pixels.

The hotspot is the point on the cursor under which mouse clicks are registered. By default, the hot spot is the upper-left corner (0,0).

ContextMenuBuiltInItems The ContextMenuBuiltInItems class describes the items that are built in to a context menu.Object The ContextMenuBuiltInItems class describes the items that are built in to a context menu. You can hide these items by using the ContextMenu.hideBuiltInItems() method. The following example uses the class ContextMenuBuiltInItemsExample to remove the normal context menu items from the stage and add a new menu item. This is accomplished with the following steps:
  1. A property myContextMenu is declared and then assigned to a new ContextMenu object.
  2. The method removeDefaultItems() is called, which removes all built-in context menu items except Print.
  3. The method addCustomMenuItems() is called, which places a menu item called Hello World into the customItems array using the push() method of Array.
  4. The Hello World menu item is then added to the Stage's context menu item list.
  5. A TextField object with the text "Right Click" is added to the center of the Stage by using addChild() via createLabel().
package { import flash.ui.ContextMenu; import flash.ui.ContextMenuItem; import flash.ui.ContextMenuBuiltInItems; import flash.display.Sprite; import flash.text.TextField; public class ContextMenuBuiltInItemsExample extends Sprite { private var myContextMenu:ContextMenu; public function ContextMenuBuiltInItemsExample() { myContextMenu = new ContextMenu(); removeDefaultItems(); addCustomMenuItems(); this.contextMenu = myContextMenu; addChild(createLabel()); } private function removeDefaultItems():void { myContextMenu.hideBuiltInItems(); var defaultItems:ContextMenuBuiltInItems = myContextMenu.builtInItems; defaultItems.print = true; } private function addCustomMenuItems():void { var item:ContextMenuItem = new ContextMenuItem("Hello World"); myContextMenu.customItems.push(item); } private function createLabel():TextField { var txtField:TextField = new TextField(); txtField.text = "Right Click"; txtField.x = this.stage.stageWidth/2 - txtField.width/2; txtField.y = this.stage.stageHeight/2 - txtField.height/2; return txtField; } } }
ContextMenu.hideBuiltInItems()ContextMenuBuiltInItems Creates a new ContextMenuBuiltInItems object so that you can set the properties for Flash Player to display or hide each menu item. Creates a new ContextMenuBuiltInItems object so that you can set the properties for Flash Player to display or hide each menu item. forwardAndBack Lets the user move forward or backward one frame in a SWF file at run time (does not appear for a single-frame SWF file).Boolean Lets the user move forward or backward one frame in a SWF file at run time (does not appear for a single-frame SWF file). loop Lets the user set a SWF file to start over automatically when it reaches the final frame (does not appear for a single-frame SWF file).Boolean Lets the user set a SWF file to start over automatically when it reaches the final frame (does not appear for a single-frame SWF file). play Lets the user start a paused SWF file (does not appear for a single-frame SWF file).Boolean Lets the user start a paused SWF file (does not appear for a single-frame SWF file). print Lets the user send the displayed frame image to a printer.Boolean Lets the user send the displayed frame image to a printer. quality Lets the user set the resolution of the SWF file at run time.Boolean Lets the user set the resolution of the SWF file at run time. rewind Lets the user set a SWF file to play from the first frame when selected, at any time (does not appear for a single-frame SWF file).Boolean Lets the user set a SWF file to play from the first frame when selected, at any time (does not appear for a single-frame SWF file). save Lets the user with Shockmachine installed save a SWF file.Boolean Lets the user with Shockmachine installed save a SWF file. zoom Lets the user zoom in and out on a SWF file at run time.Boolean Lets the user zoom in and out on a SWF file at run time.
MouseCursor The MouseCursor class is an enumeration of constant values used in setting the cursor property of the Mouse class.Object The MouseCursor class is an enumeration of constant values used in setting the cursor property of the Mouse class. flash.ui.Mouse.cursorARROW Used to specify that the arrow cursor should be used.arrowString Used to specify that the arrow cursor should be used. AUTO Used to specify that the cursor should be selected automatically based on the object under the mouse.autoString Used to specify that the cursor should be selected automatically based on the object under the mouse. BUTTON Used to specify that the button pressing hand cursor should be used.buttonString Used to specify that the button pressing hand cursor should be used. HAND Used to specify that the dragging hand cursor should be used.handString Used to specify that the dragging hand cursor should be used. IBEAM Used to specify that the I-beam cursor should be used.ibeamString Used to specify that the I-beam cursor should be used. MultitouchInputMode The MultitouchInputMode class provides values for the inputMode property in the flash.ui.Multitouch class.Object The MultitouchInputMode class provides values for the inputMode property in the flash.ui.Multitouch class. These values set the type of touch events the Flash runtime dispatches when the user interacts with a touch-enabled device. The following example displays a message when the square drawn on mySprite is tapped on a touch-enabled screen: Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT; var mySprite:Sprite = new Sprite(); var myTextField:TextField = new TextField(); mySprite.graphics.beginFill(0x336699); mySprite.graphics.drawRect(0,0,40,40); addChild(mySprite); mySprite.addEventListener(TouchEvent.TOUCH_TAP, taphandler); function taphandler(e:TouchEvent): void { myTextField.text = "I've been tapped"; myTextField.y = 50; addChild(myTextField); } flash.ui.Multitouch.inputModeGESTURE Specifies that TransformGestureEvent, PressAndTapGestureEvent, and GestureEvent events are dispatched for the related user interaction supported by the current environment, and other touch events (such as a simple tap) are interpreted as mouse events.gestureString Specifies that TransformGestureEvent, PressAndTapGestureEvent, and GestureEvent events are dispatched for the related user interaction supported by the current environment, and other touch events (such as a simple tap) are interpreted as mouse events. flash.ui.Multitouch.inputModeflash.events.TransformGestureEventflash.events.GestureEventflash.events.PressAndTapGestureEventflash.events.TouchEventNONE Specifies that all user contact with a touch-enabled device is interpreted as a type of mouse event.noneString Specifies that all user contact with a touch-enabled device is interpreted as a type of mouse event. flash.ui.Multitouch.inputModeflash.events.MouseEventTOUCH_POINT Specifies that events are dispatched only for basic touch events, such as a single finger tap.touchPointString Specifies that events are dispatched only for basic touch events, such as a single finger tap. When you use this setting, events listed in the TouchEvent class are dispatched; events listed in the TransformGestureEvent, PressAndTapGestureEvent, and GestureEvent classes are not dispatched. flash.ui.Multitouch.inputModeflash.events.TransformGestureEventflash.events.GestureEventflash.events.PressAndTapGestureEventflash.events.TouchEventContextMenu The ContextMenu class provides control over the items displayed in context menus.flash.display:NativeMenu The ContextMenu class provides control over the items displayed in context menus.

Mobile Browser Support: This class is not supported in mobile browsers.

AIR profile support: This feature is not supported on mobile devices or AIR for TV devices. See AIR Profile Support for more information regarding API support across multiple profiles.

In Flash Player, users open the context menu by right-clicking (Windows or Linux) or Control-clicking (Macintosh) Flash Player. You can use the methods and properties of the ContextMenu class to add custom menu items, control the display of the built-in context menu items (for example, Zoom In, and Print), or create copies of menus. In AIR, there are no built-in items and no standard context menu.

In Flash Professional, you can attach a ContextMenu object to a specific button, movie clip, or text field object, or to an entire movie level. You use the contextMenu property of the InteractiveObject class to do this.

In Flex or Flash Builder, only top-level components in the application can have context menus. For example, if a DataGrid control is a child of a TabNavigator or VBox container, the DataGrid control cannot have its own context menu.

To add new items to a ContextMenu object, you create a ContextMenuItem object, and then add that object to the ContextMenu.customItems array. For more information about creating context menu items, see the ContextMenuItem class entry.

Flash Player has three types of context menus: the standard menu (which appears when you right-click in Flash Player), the edit menu (which appears when you right-click a selectable or editable text field), and an error menu (which appears when a SWF file has failed to load into Flash Player). Only the standard and edit menus can be modified with the ContextMenu class. Only the edit menu appears in AIR.

Custom menu items always appear at the top of the Flash Player context menu, above any visible built-in menu items; a separator bar distinguishes built-in and custom menu items. You cannot remove the Settings menu item from the context menu. The Settings menu item is required in Flash so that users can access the settings that affect privacy and storage on their computers. You also cannot remove the About menu item, which is required so that users can find out what version of Flash Player they are using. (In AIR, the built-in Settings and About menu items are not used.)

You can add no more than 15 custom items to a context menu in Flash Player. In AIR, there is no explicit limit imposed on the number of items in a context menu.

You must use the ContextMenu() constructor to create a ContextMenu object before calling its methods.

The following example uses the class ContextMenuExample to remove the default context menu items from the Stage and add a new menu item, which, if clicked, changes the color of a square on the Stage. This is accomplished with the following steps:
  1. A property myContextMenu is declared and then assigned to a new ContextMenu object and a property redRectangle of type Sprite is declared.
  2. The method removeDefaultItems() is called, which removes all built-in context menu items except Print.
  3. The method addCustomMenuItems() is called, which places a menu item called Red to Black menu selection into the defaultItems array by using the push() method of Array. A menuItemSelect event listener is added to the ContextMenuItem object and the associated method is called menuItemSelectHandler(). This method prints out some statements using trace() whenever the context menu is accessed and Red to Black is selected. Also the red square is removed and replaced with a black one.
  4. An event listener of type menuSelect is added, along with the associated method menuSelectHandler, which simply prints out three statements using trace() every time an item in the context menu is opened.
  5. Then addChildren() draws a red square and adds it to the display list, where it is immediately displayed.
  6. Finally, myContextMenu is assigned to the context menu of the redRectangle sprite so that the custom context menu is displayed only when the mouse pointer is over the square.
package { import flash.ui.ContextMenu; import flash.ui.ContextMenuItem; import flash.ui.ContextMenuBuiltInItems; import flash.events.ContextMenuEvent; import flash.display.Sprite; import flash.display.Shape; import flash.text.TextField; public class ContextMenuExample extends Sprite { private var myContextMenu:ContextMenu; private var menuLabel:String = "Reverse Colors"; private var textLabel:String = "Right Click"; private var redRectangle:Sprite; private var label:TextField; private var size:uint = 100; private var black:uint = 0x000000; private var red:uint = 0xFF0000; public function ContextMenuExample() { myContextMenu = new ContextMenu(); removeDefaultItems(); addCustomMenuItems(); myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler); addChildren(); redRectangle.contextMenu = myContextMenu; } private function addChildren():void { redRectangle = new Sprite(); redRectangle.graphics.beginFill(red); redRectangle.graphics.drawRect(0, 0, size, size); addChild(redRectangle); redRectangle.x = size; redRectangle.y = size; label = createLabel(); redRectangle.addChild(label); } private function removeDefaultItems():void { myContextMenu.hideBuiltInItems(); var defaultItems:ContextMenuBuiltInItems = myContextMenu.builtInItems; defaultItems.print = true; } private function addCustomMenuItems():void { var item:ContextMenuItem = new ContextMenuItem(menuLabel); myContextMenu.customItems.push(item); item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler); } private function menuSelectHandler(event:ContextMenuEvent):void { trace("menuSelectHandler: " + event); } private function menuItemSelectHandler(event:ContextMenuEvent):void { trace("menuItemSelectHandler: " + event); var textColor:uint = (label.textColor == black) ? red : black; var bgColor:uint = (label.textColor == black) ? black : red; redRectangle.graphics.clear(); redRectangle.graphics.beginFill(bgColor); redRectangle.graphics.drawRect(0, 0, size, size); label.textColor = textColor; } private function createLabel():TextField { var txtField:TextField = new TextField(); txtField.text = textLabel; return txtField; } } }
ContextMenuItem classflash.display.InteractiveObject.contextMenumenuSelect Dispatched when a user first generates a context menu but before the contents of the context menu are displayed.flash.events.ContextMenuEvent.MENU_SELECTflash.events.ContextMenuEvent Dispatched when a user first generates a context menu but before the contents of the context menu are displayed. This allows your program to modify the set of context menu items before displaying the menu. The user generates the context menu by right-clicking the pointing device. ContextMenu Creates a ContextMenu object. Creates a ContextMenu object. ContextMenu.customItemsContextMenu.hideBuiltInItems()addItemAt Adds a menu item at the bottom of the menu.If item is null. ArgumentErrorArgumentErrorIf item is a member of another menu. ArgumentErrorArgumentErrorflash.display:NativeMenuItemitemflash.display:NativeMenuItemThe item to add at the bottom of the menu. indexint Adds a menu item at the bottom of the menu.

When creating a context menu, you can add either NativeMenuItem or ContextMenuItem objects. However, it is advisable to use only one type of object in a context menu so that all items in the menu have the same properties.

clone Creates a copy of the menu and all items.flash.display:NativeMenu Creates a copy of the menu and all items. containsItem Reports whether this menu contains the specified menu item.true if item is in this menu. Booleanitemflash.display:NativeMenuItemThe item to look up. Reports whether this menu contains the specified menu item. display Pops up this menu at the specified location.stageflash.display:StageThe Stage object on which to display this menu. stageXNumberThe number of horizontal pixels, relative to the origin of stage, at which to display this menu. stageYNumberThe number of vertical pixels, relative to the origin of stage, at which to display this menu. Pops up this menu at the specified location.

Note: In Flash Player, this method is not supported.

getItemAt Gets the menu item at the specified index.If index is outside the bounds of the menu's items array. RangeErrorRangeErrorThe item at the specified position in the menu. flash.display:NativeMenuItemindexintThe (zero-based) position of the item to return. Gets the menu item at the specified index. getItemIndex Gets the position of the specified item.The (zero-based) position of the specified item in this menu or -1, if the item is not in this menu. intitemflash.display:NativeMenuItemThe NativeMenuItem object to look up. Gets the position of the specified item. hideBuiltInItems Hides all built-in menu items (except Settings) in the specified ContextMenu object. Hides all built-in menu items (except Settings) in the specified ContextMenu object. If the debugger version of Flash Player is running, the Debugging menu item appears, although it is dimmed for SWF files that do not have remote debugging enabled.

This method hides only menu items that appear in the standard context menu; it does not affect items that appear in the edit and error menus.

This method works by setting all the Boolean members of my_cm.builtInItems to false. You can selectively make a built-in item visible by setting its corresponding member in my_cm.builtInItems to true.

Note: In AIR, context menus do not have built-in items. Calling this method will have no effect.

ContextMenuBuiltInItems classContextMenu.builtInItems
removeAllItems Removes all items from the menu. Removes all items from the menu. removeItemAt Removes and returns the menu item at the specified index.The NativeMenuItem object removed. flash.display:NativeMenuItemindexintThe (zero-based) position of the item to remove. Removes and returns the menu item at the specified index. builtInItems An instance of the ContextMenuBuiltInItems class with the following properties: forwardAndBack, loop, play, print, quality, rewind, save, and zoom.flash.ui:ContextMenuBuiltInItems An instance of the ContextMenuBuiltInItems class with the following properties: forwardAndBack, loop, play, print, quality, rewind, save, and zoom. Setting these properties to false removes the corresponding menu items from the specified ContextMenu object. These properties are enumerable and are set to true by default.

Note: In AIR, context menus do not have built-in items.

ContextMenuBuiltInItems classContextMenu.hideBuiltInItems()
clipboardItems An instance of the ContextMenuClipboardItems class with the following properties: cut, copy, paste, delete, selectAll.flash.ui:ContextMenuClipboardItems An instance of the ContextMenuClipboardItems class with the following properties: cut, copy, paste, delete, selectAll. Setting one of these properties to false disables the corresponding item in the clipboard menu. The following example demonstrates the use of the clipboardItems property of the ContextMenu object. Create a ContextMenu, and set its clipboardMenu property to true. Add an event handler for the MENU_SELECT (generally, right-click) event, and assign the menu to a display object. In this case, the copy and paste menus are enabled. package { import flash.ui.ContextMenu; import flash.events.ContextMenuEvent; import flash.display.Sprite; public class ContextMenuClipboardItemsExample extends Sprite { public function ContextMenuClipboardItemsExample() { var myContextMenu:ContextMenu = new ContextMenu(); myContextMenu.clipboardMenu = true; myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler); var rc:Sprite = new Sprite(); rc.graphics.beginFill(0xDDDDDD); rc.graphics.drawRect(0,0,100,30); addChild(rc); rc.contextMenu = myContextMenu; } function menuSelectHandler(event:ContextMenuEvent):void { event.contextMenuOwner.contextMenu.clipboardItems.copy = true; event.contextMenuOwner.contextMenu.clipboardItems.paste = true; } } } ContextMenuClipboardItems classclipboardMenu Specifies whether or not the clipboard menu should be used.Boolean Specifies whether or not the clipboard menu should be used. If this value is true, the clipboardItems property determines which items are enabled or disabled on the clipboard menu.

If the link property is non-null, this clipBoardMenu property is ignored.

customItems An array of ContextMenuItem objects.Array An array of ContextMenuItem objects. Each object in the array represents a context menu item that you have defined. Use this property to add, remove, or modify these custom menu items.

To add new menu items, you create a ContextMenuItem object and then add it to the customItems array (for example, by using Array.push()). For more information about creating menu items, see the ContextMenuItem class entry.

flash.display.InteractiveObject.contextMenu
isSupported The isSupported property is set to true if the ContextMenu class is supported on the current platform, otherwise it is set to false.Boolean The isSupported property is set to true if the ContextMenu class is supported on the current platform, otherwise it is set to false. items The array of custom items in this menu.Array The array of custom items in this menu.

Using this property is equivalent to using the customItems property. The array is sorted in display order.

link The URLRequest of the link.flash.net:URLRequest The URLRequest of the link. If this property is null, a normal context menu is displayed. If this property is not null, the link context menu is displayed, and operates on the url specified.

If a link is specified, the clipboardMenu property is ignored.

The default value is null.

numItems The number of items in this menu.int The number of items in this menu.
KeyLocation The KeyLocation class contains constants that indicate the location of a key pressed on the keyboard or keyboard-like input device.Object The KeyLocation class contains constants that indicate the location of a key pressed on the keyboard or keyboard-like input device.

The KeyLocation constants are used in the KeyboardEvent.keyLocation property.

flash.events.KeyboardEvent.keyLocationD_PAD Indicates the key activation originated on a directional pad of input device.4uint Indicates the key activation originated on a directional pad of input device. Example: The trackball on a mobile device or the left arrow on a remote control. LEFT Indicates the key activated is in the left key location (there is more than one possible location for this key).1uint Indicates the key activated is in the left key location (there is more than one possible location for this key). Example: The left Shift key on a PC 101 Key US keyboard. NUM_PAD Indicates the key activation originated on the numeric keypad or with a virtual key corresponding to the numeric keypad.3uint Indicates the key activation originated on the numeric keypad or with a virtual key corresponding to the numeric keypad. Example: The 1 key on a PC 101 Key US keyboard located on the numeric pad. RIGHT Indicates the key activated is in the right key location (there is more than one possible location for this key).2uint Indicates the key activated is in the right key location (there is more than one possible location for this key). Example: The right Shift key on a PC 101 Key US keyboard. STANDARD Indicates the key activation is not distinguished as the left or right version of the key, and did not originate on the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad).0uint Indicates the key activation is not distinguished as the left or right version of the key, and did not originate on the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad). Example: The Q key on a PC 101 Key US keyboard.
ContextMenuClipboardItems The ContextMenuClipboardItems class lets you enable or disable the commands in the clipboard context menu.Object The ContextMenuClipboardItems class lets you enable or disable the commands in the clipboard context menu.

Enable or disable the context menu clipboard commands using the clipboardItems property of the ContextMenu object. The clipboardItems property is an instance of this ContextMenuClipboardItems class. The clipboard context menu is shown in a context menu when the clipboardMenu property of the context menu is true, unless the context menu is for a TextField object. TextField objects control the display of the context menu and the state of its clipboard items automatically.

ContextMenu.clipboardMenuContextMenuClipboardItems Creates a new ContextMenuClipboardItems object. Creates a new ContextMenuClipboardItems object. clear Enables or disables the 'Delete' or 'Clear' item on the clipboard menu.Boolean Enables or disables the 'Delete' or 'Clear' item on the clipboard menu. This should be enabled only if an object that can be cleared is selected. copy Enables or disables the 'Copy' item on the clipboard menu.Boolean Enables or disables the 'Copy' item on the clipboard menu. This should be enabled only if an object that can be copied is selected. cut Enables or disables the 'Cut' item on the clipboard menu.Boolean Enables or disables the 'Cut' item on the clipboard menu. This should be enabled only if an object that can be cut is selected. paste Enables or disables the 'Paste' item on the clipboard menu.Boolean Enables or disables the 'Paste' item on the clipboard menu. This should be enabled only if pastable data is on the clipboard. selectAll Enables or disables the 'Select All' item on the clipboard menu.Boolean Enables or disables the 'Select All' item on the clipboard menu. This should only be enabled in a context where a selection can be expanded to include all similar items, such as in a list or a text editing control.
KeyboardType The KeyboardType class is an enumeration class that provides values for different categories of physical computer or device keyboards.Object The KeyboardType class is an enumeration class that provides values for different categories of physical computer or device keyboards.

Use the values defined by the KeyboardType class with the Keybooard.physicalKeyboardType property.

The following example is a simple test that indicates the current state of the "Num Lock" and "Caps Lock" keys as well as the type of keybaord and touch screen type in the running environment. When testing this example, click the text field to see the property values: import flash.events.~~; import flash.display.~~; import flash.ui.Keyboard; import flash.system.Capabilities; import flash.text.TextField; var keyboardInfoTxt:TextField = new TextField(); keyboardInfoTxt.x = 30; keyboardInfoTxt.y = 50; keyboardInfoTxt.width = 300; keyboardInfoTxt.height = 100; keyboardInfoTxt.border = true; addChild(keyboardInfoTxt); addEventListener (MouseEvent.CLICK, getScreenKeyboardType); function getScreenKeyboardType(e:MouseEvent):void{ keyboardInfoTxt.text= "Caps Lock is : " + String(flash.ui.Keyboard.capsLock)+ "\n" + "Num Lock is : " + String(flash.ui.Keyboard.numLock) +"\n" + "Has Virtual Keyboard : " + String(flash.ui.Keyboard.hasVirtualKeyboard) + "\n" + "Physical Keyboard Type : " + flash.ui.Keyboard.physicalKeyboardType + "\n" + "flash.system.Capabilities.touchscreenType is : " + flash.system.Capabilities.touchscreenType; }
Keyboard.physicalKeyboardTypeALPHANUMERIC A standard keyboard with a full set of numbers and letters.alphanumericString A standard keyboard with a full set of numbers and letters.

Most desktop computers and some mobile devices provide an alphanumeric keyboard.

KEYPAD A phone-style 12-button keypad.keypadString A phone-style 12-button keypad.

Many mobile devices provide a keypad, although some provide an alphanumeric keyboard.

NONE No physical keyboard is supported.noneString No physical keyboard is supported.

Typically, a virtual keyboard is provided in the absence of a physical keyboard.

flash.ui.Keyboard.hasVirtualKeyboard
Mouse The methods of the Mouse class are used to hide and show the mouse pointer, or to set the pointer to a specific style.Top-level class used to set, hide. and show the mouse pointer. Object The methods of the Mouse class are used to hide and show the mouse pointer, or to set the pointer to a specific style. The Mouse class is a top-level class whose properties and methods you can access without using a constructor. The pointer is visible by default, but you can hide it and implement a custom pointer. The following example uses the MouseExample, SimpleButton, ButtonDisplayState, and CustomCursor classes to place a simple button on the Stage. The button has a custom pointer and the button changes when clicked. This is accomplished with the following steps:
  1. Declare the following instance properties: cursor of type CustomCursor, child of type CustomButton, and gutter of type uint.
  2. Assign child to a new CustomButton instance, set its x and y coordinates to 10 pixels each, and then add the instance to the display list. The CustomButton class overrides the downState, upState, overState, and hitTestState properties in SimpleButton. Each of these properties instantiates a ButtonDisplayState object, which draws a different square, depending on the state of the child instance.
  3. The child instance is then used to add a MOUSE_OVER event listener and mouseOverHandler() listener method, along with a MOUSE_OUT event listener and associated mouseOutHandler() method.
  4. The event listeners work as follows:
    • mouseOverHandler: Hides the "normal" pointer and adds a MOUSE_MOVE listener, which processes the mouse moves using mouseMoveHandler(), described below.
    • mouseOutHandler: When the mouse moves outside the custom button, the "normal" pointer is shown, the MOUSE_MOVE event listener is removed, and the custom cursor's visibility is set to false.
    • mouseMoveHandler: Moves the custom cursor around wherever the pointer is moved and sets the custom cursor's visibility to true.
  5. Back in the MouseExample constructor, the cursor property is assigned to a new CustomCursor object and then added to the display list using addChild(). The CustomCursor class draws a small nearly black square in place of the "normal" pointer whenever the mouse is over child.
  6. A fourth event listener of type MOUSE_LEAVE is added, with the associated mouseLeaveHandler() method. In this method (called if the mouse leaves the Stage), mouseOutHandler() is passed a new mouseMove listener object, which essentially removes the pointer so it is not left on the Stage.
package { import flash.display.Sprite; import flash.display.DisplayObject; import flash.ui.Mouse; import flash.events.*; public class MouseExample extends Sprite { private var cursor:CustomCursor; private var child:CustomButton; private var gutter:uint = 10; public function MouseExample() { child = new CustomButton(); child.x = gutter; child.y = gutter; addChild(child); child.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); child.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); cursor = new CustomCursor(); addChild(cursor); stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler); } private function mouseOverHandler(event:MouseEvent):void { trace("mouseOverHandler"); Mouse.hide(); child.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); } private function mouseOutHandler(event:MouseEvent):void { trace("mouseOutHandler"); Mouse.show(); child.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); cursor.visible = false; } private function mouseMoveHandler(event:MouseEvent):void { trace("mouseMoveHandler"); cursor.x = event.localX; cursor.y = event.localY; event.updateAfterEvent(); cursor.visible = true; } private function mouseLeaveHandler(event:Event):void { trace("mouseLeaveHandler"); mouseOutHandler(new MouseEvent(MouseEvent.MOUSE_MOVE)); } } } import flash.display.Shape; import flash.display.SimpleButton; class CustomButton extends SimpleButton { var upColor:uint = 0xFFCC00; var overColor:uint = 0xCCFF00; var downColor:uint = 0x00CCFF; var size:uint = 80; public function CustomButton() { downState = new ButtonDisplayState(downColor, size+10); overState = new ButtonDisplayState(overColor, size); upState = new ButtonDisplayState(upColor, size); hitTestState = new ButtonDisplayState(upColor, size); } } class ButtonDisplayState extends Shape { var bgColor:uint; var size:uint; public function ButtonDisplayState(bgColor:uint, size:uint) { this.bgColor = bgColor; this.size = size; draw(); } private function draw():void { graphics.clear(); graphics.beginFill(bgColor); graphics.drawRect(0, 0, size, size); graphics.endFill(); } } class CustomCursor extends Shape { var bgColor:uint = 0x333333; var size:uint = 10; public function CustomCursor() { visible = false; draw(); } private function draw():void { graphics.clear(); graphics.beginFill(bgColor); graphics.drawRect(0, 0, size, size); graphics.endFill(); } }
flash.events.MouseEventhide Hides the pointer. Hides the pointer. The pointer is visible by default.

Note: You need to call Mouse.hide() only once, regardless of the number of previous calls to Mouse.show().

flash.display.DisplayObject.mouseXflash.display.DisplayObject.mouseY
registerCursor Registers a native cursor under the given name, with the given data.nameStringThe name to use as a reference to the native cursor instance. cursorflash.ui:MouseCursorDataThe properties for the native cursor, such as icon bitmap, specified as a MouseCursorData instance. Registers a native cursor under the given name, with the given data. Registers a native cursor under the given name, with the given data. flash.ui.MouseCursorDatashow Displays the pointer. Displays the pointer. The pointer is visible by default.

Note: You need to call Mouse.show() only once, regardless of the number of previous calls to Mouse.hide().

flash.display.DisplayObject.mouseXflash.display.DisplayObject.mouseY
unregisterCursor Unregisters the native cursor with the given name.nameStringThe name referring to the native cursor instance. Unregisters the native cursor with the given name. Unregisters the native cursor with the given name. cursor Sets or returns the type of cursor, or, for a native cursor, the cursor name.StringIf set to any value which is not a member of flash.ui.MouseCursor, or is not a string specified using the Mouse.registerCursor() method. ArgumentErrorArgumentErrorThe type of cursor, or, for a native cursor, the cursor name. Sets or returns the type of cursor, or, for a native cursor, the cursor name.

The default value is flash.ui.MouseCursor.AUTO.

To set values for this property, use the following string values:

String valueDescriptionflash.ui.MouseCursor.AUTOMouse cursor will change automatically based on the object under the mouse.flash.ui.MouseCursor.ARROWMouse cursor will be an arrow.flash.ui.MouseCursor.BUTTONMouse cursor will be a button clicking hand.flash.ui.MouseCursor.HANDMouse cursor will be a dragging hand.flash.ui.MouseCursor.IBEAMMouse cursor will be an I-beam.

Note: For Flash Player 10.2 or AIR 2.6 and later versions, this property sets or gets the cursor name when you are using a native cursor. A native cursor name defined using Mouse.registerCursor() overwrites currently predefined cursor types (such as flash.ui.MouseCursor.IBEAM).

flash.ui.MouseCursorregisterCursor()flash.ui.MouseCursorData
supportsCursor Indicates whether the computer or device displays a persistent cursor.Boolean Indicates whether the computer or device displays a persistent cursor.

The supportsCursor property is true on most desktop computers and false on most mobile devices.

Note: Mouse events can be dispatched whether or not this property is true. However, mouse events may behave differently depending on the physical characteristics of the pointing device.

The following example is a simple test that indicates current support for a persistent cursor, or not. When testing this example, click the text field to see the property value: import flash.events.~~; import flash.display.~~; import flash.ui.Mouse; import flash.text.TextField; var supportsCursorTxt:TextField = new TextField(); supportsCursorTxt.width = 200; supportsCursorTxt.border = true; addChild(supportsCursorTxt); addEventListener (MouseEvent.CLICK, getScreenKeyboardType); function getScreenKeyboardType(e:MouseEvent):void{ supportsCursorTxt.text= "Supports Cursor is : " + String(flash.ui.Mouse.supportsCursor); } The following example tests and responds to different user input environments. This example assumes it is part of the code for a game that uses a cursor. First, the example tests to see if the environment supports a cursor. If not, it then tests to see if the environment supports interaction with a stylus. If so, then code can be inserted to customize the game for stylus use. If the environment supports finger interaction, code can be inserted to customize the program for the specific needs of finger touches. If no pointing device is supported at all, then the developer needs to create alternative cursors or some means of interaction, such as key presses. if(Mouse.supportsCursor) { //Game acts as before } else { if(Capabilities.touchscreenType == TouchscreenType.STYLUS ){ //The Game has to change so that the character is chasing the location of the stylus as //it's dragged around. Some of the animations will have to change }else if(Capabilities.touchscreenType = TouchscreenType.FINGER){ //Same as above, except that the hit-area is larger for a finger. }else{ //There's no pointing device at all. The developer designs some sort of custom cursor to //be controlled with key presses or similar input } }
flash.system.Capabilities.touchscreenType
supportsNativeCursor Indicates whether the current configuration supports native cursors.BooleanIndicates whether the current configuration supports native cursors. Indicates whether the current configuration supports native cursors.
Keyboard The Keyboard class is used to build an interface that can be controlled by a user with a standard keyboard.Object The Keyboard class is used to build an interface that can be controlled by a user with a standard keyboard. You can use the methods and properties of the Keyboard class without using a constructor. The properties of the Keyboard class are constants representing the keys that are most commonly used to control games. isAccessible Specifies whether the last key pressed is accessible by other SWF files.The value true if the last key pressed can be accessed. If access is not permitted, this method returns false. Boolean Specifies whether the last key pressed is accessible by other SWF files. By default, security restrictions prevent code from a SWF file in one domain from accessing a keystroke generated from a SWF file in another domain. ALTERNATE Constant associated with the key code value for the Alternate (Option) key (18).18uint Constant associated with the key code value for the Alternate (Option) key (18). AUDIO Select the audio mode 0x01000017uint Select the audio mode A Constant associated with the key code value for the A key (65).65uint Constant associated with the key code value for the A key (65). BACKQUOTE Constant associated with the key code value for the ` key (192).192uint Constant associated with the key code value for the ` key (192). BACKSLASH Constant associated with the key code value for the \ key (220).220uint Constant associated with the key code value for the \ key (220). BACKSPACE Constant associated with the key code value for the Backspace key (8).8uint Constant associated with the key code value for the Backspace key (8). BACK Return to previous page in application 0x01000016uint Return to previous page in application BLUE Blue function key button 0x01000003uint Blue function key button B Constant associated with the key code value for the B key (66).66uint Constant associated with the key code value for the B key (66). CAPS_LOCK Constant associated with the key code value for the Caps Lock key (20).20uint Constant associated with the key code value for the Caps Lock key (20). CHANNEL_DOWN Channel down 0x01000005uint Channel down CHANNEL_UP Channel up 0x01000004uint Channel up COMMAND Constant associated with the Mac command key (15).15uint Constant associated with the Mac command key (15). This constant is currently only used for setting menu key equivalents. COMMA Constant associated with the key code value for the , key (188).188uint Constant associated with the key code value for the , key (188). CONTROL Constant associated with the key code value for the Control key (17).17uint Constant associated with the key code value for the Control key (17). CharCodeStrings An array containing all the defined key name constants.unknownArray An array containing all the defined key name constants. C Constant associated with the key code value for the C key (67).67uint Constant associated with the key code value for the C key (67). DELETE Constant associated with the key code value for the Delete key (46).46uint Constant associated with the key code value for the Delete key (46). DOWN Constant associated with the key code value for the Down Arrow key (40).40uint Constant associated with the key code value for the Down Arrow key (40). DVR Engage DVR application mode 0x01000019uint Engage DVR application mode D Constant associated with the key code value for the D key (68).68uint Constant associated with the key code value for the D key (68). END Constant associated with the key code value for the End key (35).35uint Constant associated with the key code value for the End key (35). ENTER Constant associated with the key code value for the Enter key (13).13uint Constant associated with the key code value for the Enter key (13). EQUAL Constant associated with the key code value for the = key (187).187uint Constant associated with the key code value for the = key (187). ESCAPE Constant associated with the key code value for the Escape key (27).27uint Constant associated with the key code value for the Escape key (27). EXIT Exits current application mode 0x01000015uint Exits current application mode E Constant associated with the key code value for the E key (69).69uint Constant associated with the key code value for the E key (69). F10 Constant associated with the key code value for the F10 key (121).121uint Constant associated with the key code value for the F10 key (121). F11 Constant associated with the key code value for the F11 key (122).122uint Constant associated with the key code value for the F11 key (122). F12 Constant associated with the key code value for the F12 key (123).123uint Constant associated with the key code value for the F12 key (123). F13 Constant associated with the key code value for the F13 key (124).124uint Constant associated with the key code value for the F13 key (124). F14 Constant associated with the key code value for the F14 key (125).125uint Constant associated with the key code value for the F14 key (125). F15 Constant associated with the key code value for the F15 key (126).126uint Constant associated with the key code value for the F15 key (126). F1 Constant associated with the key code value for the F1 key (112).112uint Constant associated with the key code value for the F1 key (112). F2 Constant associated with the key code value for the F2 key (113).113uint Constant associated with the key code value for the F2 key (113). F3 Constant associated with the key code value for the F3 key (114).114uint Constant associated with the key code value for the F3 key (114). F4 Constant associated with the key code value for the F4 key (115).115uint Constant associated with the key code value for the F4 key (115). F5 Constant associated with the key code value for the F5 key (116).116uint Constant associated with the key code value for the F5 key (116). F6 Constant associated with the key code value for the F6 key (117).117uint Constant associated with the key code value for the F6 key (117). F7 Constant associated with the key code value for the F7 key (118).118uint Constant associated with the key code value for the F7 key (118). F8 Constant associated with the key code value for the F8 key (119).119uint Constant associated with the key code value for the F8 key (119). F9 Constant associated with the key code value for the F9 key (120).120uint Constant associated with the key code value for the F9 key (120). FAST_FORWARD Engage fast-forward transport mode 0x0100000Auint Engage fast-forward transport mode F Constant associated with the key code value for the F key (70).70uint Constant associated with the key code value for the F key (70). GREEN Green function key button 0x01000001uint Green function key button GUIDE Engage program guide 0x01000014uint Engage program guide G Constant associated with the key code value for the G key (71).71uint Constant associated with the key code value for the G key (71). HELP Engage help application or context-sensitive help 0x0100001Duint Engage help application or context-sensitive help HOME Constant associated with the key code value for the Home key (36).36uint Constant associated with the key code value for the Home key (36). H Constant associated with the key code value for the H key (72).72uint Constant associated with the key code value for the H key (72). INFO Info button 0x01000013uint Info button INPUT Cycle input 0x0100001Buint Cycle input INSERT Constant associated with the key code value for the Insert key (45).45uint Constant associated with the key code value for the Insert key (45). I Constant associated with the key code value for the I key (73).73uint Constant associated with the key code value for the I key (73). J Constant associated with the key code value for the J key (74).74uint Constant associated with the key code value for the J key (74). KEYNAME_BEGIN The Begin key BeginString The Begin key KEYNAME_BREAK The Break key BreakString The Break key KEYNAME_CLEARDISPLAY The Clear Display key ClrDspString The Clear Display key KEYNAME_CLEARLINE The Clear Line key ClrLnString The Clear Line key KEYNAME_DELETECHAR The Delete Character key DelChrString The Delete Character key KEYNAME_DELETELINE The Delete Line key DelLnString The Delete Line key KEYNAME_DELETE The Delete key DeleteString The Delete key KEYNAME_DOWNARROW The down arrow DownString The down arrow KEYNAME_END The End key EndString The End key KEYNAME_EXECUTE The Execute key ExecString The Execute key KEYNAME_F10 The F10 key F10String The F10 key KEYNAME_F11 The F11 key F11String The F11 key KEYNAME_F12 The F12 key F12String The F12 key KEYNAME_F13 The F13 key F13String The F13 key KEYNAME_F14 The F14 key F14String The F14 key KEYNAME_F15 The F15 key F15String The F15 key KEYNAME_F16 The F16 key F16String The F16 key KEYNAME_F17 The F17 key F17String The F17 key KEYNAME_F18 The F18 key F18String The F18 key KEYNAME_F19 The F19 key F19String The F19 key KEYNAME_F1 The F1 key F1String The F1 key KEYNAME_F20 The F20 key F20String The F20 key KEYNAME_F21 The F21 key F21String The F21 key KEYNAME_F22 The F22 key F22String The F22 key KEYNAME_F23 The F23 key F23String The F23 key KEYNAME_F24 The F24 key F24String The F24 key KEYNAME_F25 The F25 key F25String The F25 key KEYNAME_F26 The F26 key F26String The F26 key KEYNAME_F27 The F27 key F27String The F27 key KEYNAME_F28 The F28 key F28String The F28 key KEYNAME_F29 The F29 key F29String The F29 key KEYNAME_F2 The F2 key F2String The F2 key KEYNAME_F30 The F30 key F30StringThe F30 key The F30 key KEYNAME_F31 The F31 key F31String The F31 key KEYNAME_F32 The F32 key F32String The F32 key KEYNAME_F33 The F33 key F33String The F33 key KEYNAME_F34 The F34 key F34String The F34 key KEYNAME_F35 The F35 key F35String The F35 key KEYNAME_F3 The F3 key F3String The F3 key KEYNAME_F4 The F4 key F4String The F4 key KEYNAME_F5 The F5 key F5String The F5 key KEYNAME_F6 The F6 key F6String The F6 key KEYNAME_F7 The F7 key F7String The F7 key KEYNAME_F8 The F8 key F8String The F8 key KEYNAME_F9 The F9 key F9String The F9 key KEYNAME_FIND The Find key FindString The Find key KEYNAME_HELP The Help key HelpString The Help key KEYNAME_HOME The Home key HomeString The Home key KEYNAME_INSERTCHAR The Insert Character key InsChrString The Insert Character key KEYNAME_INSERTLINE The Insert Line key InsLnString The Insert Line key KEYNAME_INSERT The Insert key InsertString The Insert key KEYNAME_LEFTARROW The left arrow LeftString The left arrow KEYNAME_MENU The Menu key MenuString The Menu key KEYNAME_MODESWITCH The Mode Switch key ModeSwString The Mode Switch key KEYNAME_NEXT The Next key NextString The Next key KEYNAME_PAGEDOWN The Page Down key PgDnString The Page Down key KEYNAME_PAGEUP The Page Up key PgUpString The Page Up key KEYNAME_PAUSE The Pause key PauseString The Pause key KEYNAME_PREV The Previous key PrevString The Previous key KEYNAME_PRINTSCREEN The Print Screen PrntScrnString The Print Screen KEYNAME_PRINT The Print key PrintString The Print key KEYNAME_REDO The Redo key RedoString The Redo key KEYNAME_RESET The Reset key ResetString The Reset key KEYNAME_RIGHTARROW The right arrow RightString The right arrow KEYNAME_SCROLLLOCK The Scroll Lock key ScrlLckString The Scroll Lock key KEYNAME_SELECT The Select key SelectString The Select key KEYNAME_STOP The Stop key StopString The Stop key KEYNAME_SYSREQ The System Request key SysReqString The System Request key KEYNAME_SYSTEM The System key SysString The System key KEYNAME_UNDO The Undo key UndoString The Undo key KEYNAME_UPARROW The up arrow UpString The up arrow KEYNAME_USER The User key UserString The User key K Constant associated with the key code value for the K key (75).75uint Constant associated with the key code value for the K key (75). LAST Watch last channel or show watched 0x01000011uint Watch last channel or show watched LEFTBRACKET Constant associated with the key code value for the [ key (219).219uint Constant associated with the key code value for the [ key (219). LEFT Constant associated with the key code value for the Left Arrow key (37).37uint Constant associated with the key code value for the Left Arrow key (37). LIVE Return to live [position in broadcast] 0x01000010uint Return to live [position in broadcast] L Constant associated with the key code value for the L key (76).76uint Constant associated with the key code value for the L key (76). MASTER_SHELL Engage "Master Shell" e.g.0x0100001Euint Engage "Master Shell" e.g. TiVo or other vendor button MENU Engage menu 0x01000012uint Engage menu MINUS Constant associated with the key code value for the - key (189).189uint Constant associated with the key code value for the - key (189). M Constant associated with the key code value for the M key (77).77uint Constant associated with the key code value for the M key (77). NEXT Skip to next track or chapter 0x0100000Euint Skip to next track or chapter NUMBER_0 Constant associated with the key code value for the 0 key (48).48uint Constant associated with the key code value for the 0 key (48). NUMBER_1 Constant associated with the key code value for the 1 key (49).49uint Constant associated with the key code value for the 1 key (49). NUMBER_2 Constant associated with the key code value for the 2 key (50).50uint Constant associated with the key code value for the 2 key (50). NUMBER_3 Constant associated with the key code value for the 3 key (51).51uint Constant associated with the key code value for the 3 key (51). NUMBER_4 Constant associated with the key code value for the 4 key (52).52uint Constant associated with the key code value for the 4 key (52). NUMBER_5 Constant associated with the key code value for the 5 key (53).53uint Constant associated with the key code value for the 5 key (53). NUMBER_6 Constant associated with the key code value for the 6 key (54).54uint Constant associated with the key code value for the 6 key (54). NUMBER_7 Constant associated with the key code value for the 7 key (55).55uint Constant associated with the key code value for the 7 key (55). NUMBER_8 Constant associated with the key code value for the 8 key (56).56uint Constant associated with the key code value for the 8 key (56). NUMBER_9 Constant associated with the key code value for the 9 key (57).57uint Constant associated with the key code value for the 9 key (57). NUMPAD_0 Constant associated with the key code value for the number 0 key on the number pad (96).96uint Constant associated with the key code value for the number 0 key on the number pad (96). NUMPAD_1 Constant associated with the key code value for the number 1 key on the number pad (97).97uint Constant associated with the key code value for the number 1 key on the number pad (97). NUMPAD_2 Constant associated with the key code value for the number 2 key on the number pad (98).98uint Constant associated with the key code value for the number 2 key on the number pad (98). NUMPAD_3 Constant associated with the key code value for the number 3 key on the number pad (99).99uint Constant associated with the key code value for the number 3 key on the number pad (99). NUMPAD_4 Constant associated with the key code value for the number 4 key on the number pad (100).100uint Constant associated with the key code value for the number 4 key on the number pad (100). NUMPAD_5 Constant associated with the key code value for the number 5 key on the number pad (101).101uint Constant associated with the key code value for the number 5 key on the number pad (101). NUMPAD_6 Constant associated with the key code value for the number 6 key on the number pad (102).102uint Constant associated with the key code value for the number 6 key on the number pad (102). NUMPAD_7 Constant associated with the key code value for the number 7 key on the number pad (103).103uint Constant associated with the key code value for the number 7 key on the number pad (103). NUMPAD_8 Constant associated with the key code value for the number 8 key on the number pad (104).104uint Constant associated with the key code value for the number 8 key on the number pad (104). NUMPAD_9 Constant associated with the key code value for the number 9 key on the number pad (105).105uint Constant associated with the key code value for the number 9 key on the number pad (105). NUMPAD_ADD Constant associated with the key code value for the addition key on the number pad (107).107uint Constant associated with the key code value for the addition key on the number pad (107). NUMPAD_DECIMAL Constant associated with the key code value for the decimal key on the number pad (110).110uint Constant associated with the key code value for the decimal key on the number pad (110). NUMPAD_DIVIDE Constant associated with the key code value for the division key on the number pad (111).111uint Constant associated with the key code value for the division key on the number pad (111). NUMPAD_ENTER Constant associated with the key code value for the Enter key on the number pad (108).108uint Constant associated with the key code value for the Enter key on the number pad (108). NUMPAD_MULTIPLY Constant associated with the key code value for the multiplication key on the number pad (106).106uint Constant associated with the key code value for the multiplication key on the number pad (106). NUMPAD_SUBTRACT Constant associated with the key code value for the subtraction key on the number pad (109).109uint Constant associated with the key code value for the subtraction key on the number pad (109). NUMPAD Constant associated with the pseudo-key code for the the number pad (21).21uint Constant associated with the pseudo-key code for the the number pad (21). Use to set numpad modifier on key equivalents N Constant associated with the key code value for the N key (78).78uint Constant associated with the key code value for the N key (78). O Constant associated with the key code value for the O key (79).79uint Constant associated with the key code value for the O key (79). PAGE_DOWN Constant associated with the key code value for the Page Down key (34).34uint Constant associated with the key code value for the Page Down key (34). PAGE_UP Constant associated with the key code value for the Page Up key (33).33uint Constant associated with the key code value for the Page Up key (33). PAUSE Engage pause transport mode 0x01000008uint Engage pause transport mode PERIOD Constant associated with the key code value for the .190uint Constant associated with the key code value for the . key (190). PLAY Engage play transport mode 0x01000007uint Engage play transport mode PREVIOUS Skip to previous track or chapter 0x0100000Fuint Skip to previous track or chapter P Constant associated with the key code value for the P key (80).80uint Constant associated with the key code value for the P key (80). QUOTE Constant associated with the key code value for the ' key (222).222uint Constant associated with the key code value for the ' key (222). Q Constant associated with the key code value for the Q key (81).81uint Constant associated with the key code value for the Q key (81). RECORD Record item or engage record transport mode 0x01000006uint Record item or engage record transport mode RED Red function key button 0x01000000uint Red function key button REWIND Engage rewind transport mode 0x0100000Buint Engage rewind transport mode RIGHTBRACKET Constant associated with the key code value for the ] key (221).221uint Constant associated with the key code value for the ] key (221). RIGHT Constant associated with the key code value for the Right Arrow key (39).39uint Constant associated with the key code value for the Right Arrow key (39). R Constant associated with the key code value for the R key (82).82uint Constant associated with the key code value for the R key (82). SEARCH Search button 0x0100001Fuint Search button SEMICOLON Constant associated with the key code value for the ; key (186).186uint Constant associated with the key code value for the ; key (186). SETUP Engage setup application or menu 0x0100001Cuint Engage setup application or menu SHIFT Constant associated with the key code value for the Shift key (16).16uint Constant associated with the key code value for the Shift key (16). SKIP_BACKWARD Quick skip backward (usually 7-10 seconds) 0x0100000Duint Quick skip backward (usually 7-10 seconds) SKIP_FORWARD Quick skip ahead (usually 30 seconds) 0x0100000Cuint Quick skip ahead (usually 30 seconds) SLASH Constant associated with the key code value for the / key (191).191uint Constant associated with the key code value for the / key (191). SPACE Constant associated with the key code value for the Spacebar (32).32uint Constant associated with the key code value for the Spacebar (32). STOP Engage stop transport mode 0x01000009uint Engage stop transport mode STRING_BEGIN The OS X Unicode Begin constant String The OS X Unicode Begin constant STRING_BREAK The OS X Unicode Break constant String The OS X Unicode Break constant STRING_CLEARDISPLAY The OS X Unicode Clear Display constant String The OS X Unicode Clear Display constant STRING_CLEARLINE The OS X Unicode Clear Line constant String The OS X Unicode Clear Line constant STRING_DELETECHAR The OS X Unicode Delete Character constant String The OS X Unicode Delete Character constant STRING_DELETELINE The OS X Unicode Delete Line constant String The OS X Unicode Delete Line constant STRING_DELETE The OS X Unicode Delete constant String The OS X Unicode Delete constant STRING_DOWNARROW The OS X Unicode down arrow constant String The OS X Unicode down arrow constant STRING_END The OS X Unicode End constant String The OS X Unicode End constant STRING_EXECUTE The OS X Unicode Execute constant String The OS X Unicode Execute constant STRING_F10 The OS X Unicode F10 constant String The OS X Unicode F10 constant STRING_F11 The OS X Unicode F11 constant String The OS X Unicode F11 constant STRING_F12 The OS X Unicode F12 constant String The OS X Unicode F12 constant STRING_F13 The OS X Unicode F13 constant String The OS X Unicode F13 constant STRING_F14 The OS X Unicode F14 constant String The OS X Unicode F14 constant STRING_F15 The OS X Unicode F15 constant String The OS X Unicode F15 constant STRING_F16 The OS X Unicode F16 constant String The OS X Unicode F16 constant STRING_F17 The OS X Unicode F17 constant String The OS X Unicode F17 constant STRING_F18 The OS X Unicode F18 constant String The OS X Unicode F18 constant STRING_F19 The OS X Unicode F19 constant String The OS X Unicode F19 constant STRING_F1 The OS X Unicode F1 constant String The OS X Unicode F1 constant STRING_F20 The OS X Unicode F20 constant String The OS X Unicode F20 constant STRING_F21 The OS X Unicode F21 constant String The OS X Unicode F21 constant STRING_F22 The OS X Unicode F22 constant String The OS X Unicode F22 constant STRING_F23 The OS X Unicode F23 constant String The OS X Unicode F23 constant STRING_F24 The OS X Unicode F24 constant String The OS X Unicode F24 constant STRING_F25 The OS X Unicode F25 constant String The OS X Unicode F25 constant STRING_F26 The OS X Unicode F26 constant String The OS X Unicode F26 constant STRING_F27 The OS X Unicode F27 constant String The OS X Unicode F27 constant STRING_F28 The OS X Unicode F28 constant String The OS X Unicode F28 constant STRING_F29 The OS X Unicode F29 constant String The OS X Unicode F29 constant STRING_F2 The OS X Unicode F2 constant String The OS X Unicode F2 constant STRING_F30 The OS X Unicode F30 constant String The OS X Unicode F30 constant STRING_F31 The OS X Unicode F31 constant String The OS X Unicode F31 constant STRING_F32 The OS X Unicode F32 constant String The OS X Unicode F32 constant STRING_F33 The OS X Unicode F33 constant String The OS X Unicode F33 constant STRING_F34 The OS X Unicode F34 constant String The OS X Unicode F34 constant STRING_F35 The OS X Unicode F35 constant String The OS X Unicode F35 constant STRING_F3 The OS X Unicode F3 constant String The OS X Unicode F3 constant STRING_F4 The OS X Unicode F4 constant String The OS X Unicode F4 constant STRING_F5 The OS X Unicode F5 constant String The OS X Unicode F5 constant STRING_F6 The OS X Unicode F6 constant String The OS X Unicode F6 constant STRING_F7 The OS X Unicode F7 constant String The OS X Unicode F7 constant STRING_F8 The OS X Unicode F8 constant String The OS X Unicode F8 constant STRING_F9 The OS X Unicode F9 constant String The OS X Unicode F9 constant STRING_FIND The OS X Unicode Find constant String The OS X Unicode Find constant STRING_HELP The OS X Unicode Help constant String The OS X Unicode Help constant STRING_HOME The OS X Unicode Home constant String The OS X Unicode Home constant STRING_INSERTCHAR The OS X Unicode Insert Character constant String The OS X Unicode Insert Character constant STRING_INSERTLINE The OS X Unicode Insert Line constant String The OS X Unicode Insert Line constant STRING_INSERT The OS X Unicode Insert constant String The OS X Unicode Insert constant STRING_LEFTARROW The OS X Unicode left arrow constant String The OS X Unicode left arrow constant STRING_MENU The OS X Unicode Menu constant String The OS X Unicode Menu constant STRING_MODESWITCH The OS X Unicode Mode Switch constant String The OS X Unicode Mode Switch constant STRING_NEXT The OS X Unicode Next constant String The OS X Unicode Next constant STRING_PAGEDOWN The OS X Unicode Page Down constant String The OS X Unicode Page Down constant STRING_PAGEUP The OS X Unicode Page Up constant String The OS X Unicode Page Up constant STRING_PAUSE The OS X Unicode Pause constant String The OS X Unicode Pause constant STRING_PREV The OS X Unicode Previous constant String The OS X Unicode Previous constant STRING_PRINTSCREEN The OS X Unicode Print Screen constant String The OS X Unicode Print Screen constant STRING_PRINT The OS X Unicode Print constant String The OS X Unicode Print constant STRING_REDO The OS X Unicode Redo constant String The OS X Unicode Redo constant STRING_RESET The OS X Unicode Reset constant String The OS X Unicode Reset constant STRING_RIGHTARROW The OS X Unicode right arrow constant String The OS X Unicode right arrow constant STRING_SCROLLLOCK The OS X Unicode Scroll Lock constant String The OS X Unicode Scroll Lock constant STRING_SELECT The OS X Unicode Select constant String The OS X Unicode Select constant STRING_STOP The OS X Unicode Stop constant String The OS X Unicode Stop constant STRING_SYSREQ The OS X Unicode System Request constant String The OS X Unicode System Request constant STRING_SYSTEM The OS X Unicode System constant String The OS X Unicode System constant STRING_UNDO The OS X Unicode Undo constant String The OS X Unicode Undo constant STRING_UPARROW The OS X Unicode up arrow constant String The OS X Unicode up arrow constant STRING_USER The OS X Unicode User constant String The OS X Unicode User constant SUBTITLE Toggle subtitles 0x01000018uint Toggle subtitles S Constant associated with the key code value for the S key (83).83uint Constant associated with the key code value for the S key (83). TAB Constant associated with the key code value for the Tab key (9).9uint Constant associated with the key code value for the Tab key (9). T Constant associated with the key code value for the T key (84).84uint Constant associated with the key code value for the T key (84). UP Constant associated with the key code value for the Up Arrow key (38).38uint Constant associated with the key code value for the Up Arrow key (38). U Constant associated with the key code value for the U key (85).85uint Constant associated with the key code value for the U key (85). VOD Engage video-on-demand 0x0100001Auint Engage video-on-demand V Constant associated with the key code value for the V key (86).86uint Constant associated with the key code value for the V key (86). W Constant associated with the key code value for the W key (87).87uint Constant associated with the key code value for the W key (87). X Constant associated with the key code value for the X key (88).88uint Constant associated with the key code value for the X key (88). YELLOW Yellow function key button 0x01000002uint Yellow function key button Y Constant associated with the key code value for the Y key (89).89uint Constant associated with the key code value for the Y key (89). Z Constant associated with the key code value for the Z key (90).90uint Constant associated with the key code value for the Z key (90). capsLock Specifies whether the Caps Lock key is activated (true) or not (false).Boolean Specifies whether the Caps Lock key is activated (true) or not (false). hasVirtualKeyboard Indicates whether the computer or device provides a virtual keyboard.Boolean Indicates whether the computer or device provides a virtual keyboard. If the current environment provides a virtual keyboard, this value is true. The following example is a simple test that indicates the current state of the "Num Lock" and "Caps Lock" keys as well as the type of keybaord and touch screen type in the running environment. When testing this example, click the text field to see the property values: import flash.events.~~; import flash.display.~~; import flash.ui.Keyboard; import flash.system.Capabilities; import flash.text.TextField; var keyboardInfoTxt:TextField = new TextField(); keyboardInfoTxt.x = 30; keyboardInfoTxt.y = 50; keyboardInfoTxt.width = 300; keyboardInfoTxt.height = 100; keyboardInfoTxt.border = true; addChild(keyboardInfoTxt); addEventListener (MouseEvent.CLICK, getScreenKeyboardType); function getScreenKeyboardType(e:MouseEvent):void{ keyboardInfoTxt.text= "Caps Lock is : " + String(flash.ui.Keyboard.capsLock)+ "\n" + "Num Lock is : " + String(flash.ui.Keyboard.numLock) +"\n" + "Has Virtual Keyboard : " + String(flash.ui.Keyboard.hasVirtualKeyboard) + "\n" + "Physical Keyboard Type : " + flash.ui.Keyboard.physicalKeyboardType + "\n" + "flash.system.Capabilities.touchscreenType is : " + flash.system.Capabilities.touchscreenType; } numLock Specifies whether the Num Lock key is activated (true) or not (false).Boolean Specifies whether the Num Lock key is activated (true) or not (false). physicalKeyboardType Indicates the type of physical keyboard provided by the computer or device, if any.String Indicates the type of physical keyboard provided by the computer or device, if any.

Use the constants defined in the KeyboardType class to test the values reported by this property.

Note: If a computer or device has both an alphanumeric keyboard and a 12-button keypad, this property only reports the presence of the alphanumeric keyboard.

KeyboardType class
Multitouch The Multitouch class manages and provides information about the current environment's support for handling contact from user input devices, including contact that has two or more touch points (such as a user's fingers on a touch screen).manages and indicates support for touch interaction Object The Multitouch class manages and provides information about the current environment's support for handling contact from user input devices, including contact that has two or more touch points (such as a user's fingers on a touch screen). When a user interacts with a device such as a mobile phone or tablet with a touch screen, the user typically touches the screen with his or her fingers or a pointing device. While there is a broad range of pointing devices, such as a mouse or a stylus, many of these devices only have a single point of contact with an application. For pointing devices with a single point of contact, user interaction events can be handled as a mouse event, or using a basic set of touch events (called "touch point" events). However, for pointing devices that have several points of contact and perform complex movement, such as the human hand, Flash runtimes support an additional set of event handling API called gesture events. The API for handling user interaction with these gesture events includes the following classes:

  • flash.events.TouchEvent
  • flash.events.GestureEvent
  • flash.events.GesturePhase
  • flash.events.TransformGestureEvent
  • flash.events.PressAndTapGestureEvent

Use the listed classes to write code that handles touch events. Use the Multitouch class to determine the current environment's support for touch interaction, and to manage the support of touch interaction if the current environment supports touch input.

You cannot create a Multitouch object directly from ActionScript code. If you call new Multitouch(), an exception is thrown.

Note: The Multitouch feature is not supported for SWF files embedded in HTML running on Mac OS.

The following example first checks to see if gesture events are supported (if the machine doesn't support gesture events, the vector array Multitouch.supportedGestures returns null and assigning null to the vector of strings causes a run-time error). If gesture events are supported, the example displays the events from the TransformGestureEvent class supported in the current environment: package { import flash.ui.Multitouch; import flash.ui.MultitouchInputMode; import flash.display.Sprite; import flash.text.TextField; public class MultitouchExample extends Sprite { Multitouch.inputMode = MultitouchInputMode.GESTURE; public function MultitouchExample() { if(Multitouch.supportsGestureEvents){ var supportedGesturesVar:Vector.<String> = Multitouch.supportedGestures; var deviceSupports:TextField = new TextField(); deviceSupports.width = 200; deviceSupports.height = 200; deviceSupports.wordWrap = true; for (var i:int=0; i<supportedGesturesVar.length; ++i) { deviceSupports.appendText(supportedGesturesVar[i] + ", "); addChild(deviceSupports); } } } } }
flash.events.TouchEventflash.events.GestureEventflash.events.TransformGestureEventflash.events.GesturePhaseflash.events.PressAndTapGestureEventflash.events.MouseEventflash.events.EventDispatcher.addEventListener()Michael Chaize: Tetris, Touch API and AndroidChristian Cantrell: Multitouch and gesture support on the Flash PlatformLee Brimelow: Flash Player 10.1 multi-touch FAQPiotr Walczyszyn: Multitouch development in FlexinputMode Identifies the multi-touch mode for touch and gesture event handling.Stringgesture Identifies the multi-touch mode for touch and gesture event handling. Use this property to manage whether or not events are dispatched as touch events with multiple points of contact and specific events for different gestures (such as rotation and pan), or only a single point of contact (such as tap), or none at all (contact is handled as a mouse event). To set this property, use values from the flash.ui.MultitouchInputMode class. The following example displays a message when the square drawn on mySprite is tapped on a touch-enabled screen: Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT; var mySprite:Sprite = new Sprite(); var myTextField:TextField = new TextField(); mySprite.graphics.beginFill(0x336699); mySprite.graphics.drawRect(0,0,40,40); addChild(mySprite); mySprite.addEventListener(TouchEvent.TOUCH_TAP, taphandler); function taphandler(e:TouchEvent): void { myTextField.text = "I've been tapped"; myTextField.y = 50; addChild(myTextField); } flash.ui.MultitouchInputModemaxTouchPoints The maximum number of concurrent touch points supported by the current environment.intmaximum number of concurrent touch points for mult-touch interaction The maximum number of concurrent touch points supported by the current environment. flash.events.TouchEventflash.events.MouseEventflash.events.EventDispatcher.addEventListener()flash.events.GestureEventflash.events.TransformGestureEventsupportedGestures A Vector array (a typed array of string values) of multi-touch contact types supported in the current environment.indicates current support for mult-touch interaction A Vector array (a typed array of string values) of multi-touch contact types supported in the current environment. The array of strings can be used as event types to register event listeners. Possible values are constants from the GestureEvent, PressAndTapGestureEvent, and TransformGestureEvent classes (such as GESTURE_PAN).

If the Flash runtime is in an environment that does not support any multi-touch gestures, the value is null.

Note: For Mac OS 10.5.3 and later, Multitouch.supportedGestures returns non-null values (possibly indicating incorrectly that gesture events are supported) even if the current hardware does not support gesture input.

Use this property to test for multi-touch gesture support. Then, use event handlers for the available multi-touch gestures. For those gestures that are not supported in the current evironment, you'll need to create alternative event handling.

The following example adds the appropriate event listeners for each individual supported gesture in the current environment. The Multitouch.supportedGestures vector array contents change to include all the gestures available to the current software and hardware environment for the Flash runtime. If the Multitouch.supportedGestures vector array does not contain one of the TransformGestureEvent gestures, then no event listener is added for that gesture. This example comes from Holly Schinsky. Multitouch.inputMode = MultitouchInputMode.GESTURE; for each (var item:String in Multitouch.supportedGestures) { trace("gesture " + item); if (item == TransformGestureEvent.GESTURE_PAN) img.addEventListener(TransformGestureEvent.GESTURE_PAN, onPan); else if (item == TransformGestureEvent.GESTURE_ROTATE) img.addEventListener(TransformGestureEvent.GESTURE_ROTATE, onRotate); else if (item == TransformGestureEvent.GESTURE_SWIPE) img.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe); else if (item == TransformGestureEvent.GESTURE_ZOOM) img.addEventListener(TransformGestureEvent.GESTURE_ZOOM, onZoom); }
flash.events.TouchEventflash.events.MouseEventflash.events.EventDispatcher.addEventListener()flash.events.GestureEventflash.events.PressAndTapGestureEventflash.events.TransformGestureEvent
supportsGestureEvents Indicates whether the current environment supports gesture input, such as rotating two fingers around a touch screen.Boolean Indicates whether the current environment supports gesture input, such as rotating two fingers around a touch screen. Gesture events are listed in the TransformGestureEvent, PressAndTapGestureEvent, and GestureEvent classes.

Note: For Mac OS 10.5.3 and later, this value is always true. Multitouch.supportsGestureEvent returns true even if the hardware does not support gesture events.

flash.events.TransformGestureEventflash.events.GestureEventflash.events.PressAndTapGestureEvent
supportsTouchEvents Indicates whether the current environment supports basic touch input, such as a single finger tap.Boolean Indicates whether the current environment supports basic touch input, such as a single finger tap. Touch events are listed in the TouchEvent class. The following example displays whether or not the current environment supports touch events: var myTextField:TextField = new TextField(); myTextField.width = 200; addEventListener(Event.ENTER_FRAME, enterhandler); function enterhandler(e:Event): void { var support:Boolean = Multitouch.supportsTouchEvents; switch (support) { case true : myTextField.text = "Touch events supported"; break; case false : myTextField.text = "Touch events not supported"; break; default : myTextField.text = "unknown"; } addChild(myTextField); } flash.events.TouchEvent
ContextMenuItem The ContextMenuItem class represents an item in the context menu.flash.display:NativeMenuItem The ContextMenuItem class represents an item in the context menu. Each ContextMenuItem object has a caption (text) that is displayed in the context menu. To add a new item to a context menu, you add it to the customItems array of a ContextMenu object.

With the properties of the ContextMenuItem class you can enable or disable specific menu items, and you can make items visible or invisible.

You write an event handler for the menuItemSelect event to add functionality to the menu item when the user selects it.

Custom menu items appear at the top of the context menu, above any built-in items. A separator bar divides custom menu items from built-in items. In AIR, there are no built-in items and the following restrictions do not apply to content in the AIR application sandbox.

Restrictions:

  • You can add no more than 15 custom items to a context menu.
  • Each caption must contain at least one visible character.
  • Control characters, newlines, and other white space characters are ignored.
  • No caption can be more than 100 characters long.
  • Captions that are identical to any built-in menu item, or to another custom item, are ignored, whether the matching item is visible or not. Menu captions are compared to built-in captions or existing custom captions without regard to case, punctuation, or white space.
  • The following captions are not allowed, but the words may be used in conjunction with other words to form a custom caption (for example, although "Paste" is not allowed, "Paste tastes great" is allowed):
     Save
     Zoom In
     Zoom Out
     100%
     Show All
     Quality
     Play
     Loop
     Rewind
     Forward
     Back
     Movie not loaded
     About
     Print
     Show Redraw Regions
     Debugger
     Undo
     Cut
     Copy
     Paste
     Delete
     Select All
     Open
     Open in new window
     Copy link
     
  • None of the following words can appear in a custom caption on their own or in conjunction with other words:
     Adobe
     Macromedia
     Flash Player
     Settings
     

Note: When the player is running on a non-English system, the caption strings are compared to both the English list and the localized equivalents.

The following example uses the class ContextMenuBuiltInItemsExample to remove the default context menu items from the Stage and add a new menu item. This is accomplished with the following steps:
  1. A property myContextMenu is declared and then assigned to a new ContextMenu object.
  2. The method removeDefaultItems() is called, which removes all built-in context menu items except Print.
  3. The method addCustomMenuItems() is called, which places a menu item called Hello World into the customItems array by using the push() method of Array.
  4. The Hello World context menu item is added to the Stage's context menu item list.
  5. A TextField object with the text "Right Click Here" is added to the stage.
package { import flash.ui.ContextMenu; import flash.ui.ContextMenuItem; import flash.ui.ContextMenuBuiltInItems; import flash.display.Sprite; import flash.text.TextField; public class ContextMenuItemExample extends Sprite { private var myContextMenu:ContextMenu; public function ContextMenuItemExample() { myContextMenu = new ContextMenu(); removeDefaultItems(); addCustomMenuItems(); this.contextMenu = myContextMenu; addChild(createLabel()); } private function removeDefaultItems():void { myContextMenu.hideBuiltInItems(); var defaultItems:ContextMenuBuiltInItems = myContextMenu.builtInItems; defaultItems.print = true; } private function addCustomMenuItems():void { var item:ContextMenuItem = new ContextMenuItem("Hello World"); myContextMenu.customItems.push(item); } private function createLabel():TextField { var txtField:TextField = new TextField(); txtField.text = "Right Click Here"; return txtField; } } }
ContextMenu classContextMenuBuiltInItems classmenuItemSelect Dispatched when a user selects an item from a context menu.flash.events.ContextMenuEvent.MENU_ITEM_SELECTflash.events.ContextMenuEvent Dispatched when a user selects an item from a context menu. The user generates the context menu by clicking the secondary button of the user's pointing device. ContextMenuItem Creates a new ContextMenuItem object that can be added to the ContextMenu.customItems array.captionStringSpecifies the text associated with the menu item. See the ContextMenuItem class overview for caption value restrictions. separatorBeforeBooleanfalseSpecifies whether a separator bar appears above the menu item in the context menu. The default value is false. enabledBooleantrueSpecifies whether the menu item is enabled or disabled in the context menu. The default value is true (enabled). This parameter is optional. visibleBooleantrueSpecifies whether the menu item is visible or invisible. The default value is true (visible). Creates a new ContextMenuItem object that can be added to the ContextMenu.customItems array. clone Creates a copy of the NativeMenuItem object.flash.display:NativeMenuItem Creates a copy of the NativeMenuItem object. systemClearMenuItemflash.ui:ContextMenuItemsystemCopyLinkMenuItemflash.ui:ContextMenuItemsystemCopyMenuItemflash.ui:ContextMenuItemsystemCutMenuItemflash.ui:ContextMenuItemsystemOpenLinkMenuItemflash.ui:ContextMenuItemsystemPasteMenuItemflash.ui:ContextMenuItemsystemSelectAllMenuItemflash.ui:ContextMenuItemcaption Specifies the menu item caption (text) displayed in the context menu.String Specifies the menu item caption (text) displayed in the context menu. See the ContextMenuItem class overview for caption value restrictions. separatorBefore Indicates whether a separator bar should appear above the specified menu item.Booleanfalse Indicates whether a separator bar should appear above the specified menu item.

Note: A separator bar always appears between any custom menu items and the built-in menu items.

visible Indicates whether the specified menu item is visible when the Flash Player context menu is displayed.Booleantrue Indicates whether the specified menu item is visible when the Flash Player context menu is displayed.