Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.ui 
ContextMenuBuiltInItems 
Packageflash.ui
Classpublic final class ContextMenuBuiltInItems
InheritanceContextMenuBuiltInItems Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

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.

View the examples

See also



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  forwardAndBack : 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).
ContextMenuBuiltInItems
  loop : 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).
ContextMenuBuiltInItems
  play : Boolean
Lets the user start a paused SWF file (does not appear for a single-frame SWF file).
ContextMenuBuiltInItems
  print : Boolean
Lets the user send the displayed frame image to a printer.
ContextMenuBuiltInItems
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  quality : Boolean
Lets the user set the resolution of the SWF file at run time.
ContextMenuBuiltInItems
  rewind : 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).
ContextMenuBuiltInItems
  save : Boolean
Lets the user with Shockmachine installed save a SWF file.
ContextMenuBuiltInItems
  zoom : Boolean
Lets the user zoom in and out on a SWF file at run time.
ContextMenuBuiltInItems
Public Methods
 MethodDefined By
  
Creates a new ContextMenuBuiltInItems object so that you can set the properties for Flash Player to display or hide each menu item.
ContextMenuBuiltInItems
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

forwardAndBack

property
forwardAndBack:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

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).



Implementation
    public function get forwardAndBack():Boolean
    public function set forwardAndBack(value:Boolean):void

loop

property 
loop:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

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).



Implementation
    public function get loop():Boolean
    public function set loop(value:Boolean):void

play

property 
play:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

Lets the user start a paused SWF file (does not appear for a single-frame SWF file).



Implementation
    public function get play():Boolean
    public function set play(value:Boolean):void

print

property 
print:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

Lets the user send the displayed frame image to a printer.



Implementation
    public function get print():Boolean
    public function set print(value:Boolean):void

quality

property 
quality:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

Lets the user set the resolution of the SWF file at run time.



Implementation
    public function get quality():Boolean
    public function set quality(value:Boolean):void

rewind

property 
rewind:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

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).



Implementation
    public function get rewind():Boolean
    public function set rewind(value:Boolean):void

save

property 
save:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

Lets the user with Shockmachine installed save a SWF file.



Implementation
    public function get save():Boolean
    public function set save(value:Boolean):void

zoom

property 
zoom:Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

Lets the user zoom in and out on a SWF file at run time.



Implementation
    public function get zoom():Boolean
    public function set zoom(value:Boolean):void
Constructor Detail

ContextMenuBuiltInItems

()Constructor
public function ContextMenuBuiltInItems()

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0 Flash Player 9

Creates a new ContextMenuBuiltInItems object so that you can set the properties for Flash Player to display or hide each menu item.

ContextMenuBuiltinItemsExample.as

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;
        }
    }
}