[ Pobierz całość w formacie PDF ]
.item_menu A reference to the ContextMenu object assigned to the menu property of object.ReturnsNothing.DescriptionEvent handler; called when a user invokes the Flash Player context menu, but before the menu isactually displayed.This lets you customize the contents of the context menu based on the currentapplication state.You can also specify the callback handler for a ContextMenu object when you construct a newContextMenu object.For more information, see the ContextMenu class entry.340 Chapter 12: ActionScript Dictionary ExampleThe following example determines over what type of object the context menu was invoked.my_cm = new ContextMenu();menuHandler = function (obj:Object, menu:ContextMenu) {if(obj instanceof MovieClip) {trace("Movie clip: " + obj);}if(obj instanceof TextField) {trace("Text field: " + obj);}if(obj instanceof Button) {trace("Button: " + obj);}}my_cm.onSelect = menuHandler;ContextMenuItem classAvailabilityFlash Player 7.DescriptionYou use the ContextMenuItem class to create custom menu items to display in the Flash Playercontext menu.Each ContextMenuItem object has a caption (text) that s displayed in the contextmenu and a callback handler (a function) that s invoked when the menu item is selected.To add anew context menu item to a context menu, you add it to the customItems array of aContextMenu object.You can enable or disable specific menu items, make items visible or invisible, or change thecaption or callback handler associated with a menu item.Custom menu items appear at the top of the context menu, above any built-in items.A separatorbar always divides custom menu items from built-in items.You can add no more than 15 customitems to the Flash Player context menu.Each item must contain at least one visible charactercontrol characters, newlines, and other white space characters are ignored.No item can be morethan 100 characters long.Items that are identical to any built-in menu item, or to another customitem, are ignored, whether the matching item is visible or not.Menu items are compared withoutregard to case, punctuation, or white space.None of the following words can appear in a custom item: Macromedia, Flash Player, or Settings.Method summary for the ContextMenuItem classMethod DescriptionContextMenuItem.copy() Returns a copy of the specified ContextMenuItem object.ContextMenuItem class 341 Property summary for the ContextMenuItem classProperty DescriptionContextMenuItem.caption Specifies the text displayed in the menu item.ContextMenuItem.enabled Specifies whether the menu item is enabled or disabled.ContextMenuItem.separatorBefore Specifies whether a separator bar should appear above themenu item.ContextMenuItem.visible Specifies whether the menu item is visible or not.Event handler summary for the ContextMenuItem classEvent handler DescriptionContextMenuItem.onSelect Invoked when the menu item is selected.Constructor for the ContextMenuItem classAvailabilityFlash Player 7.Usagenew ContextMenuItem(caption, callbackFunction, [ separatorBefore, [ enabled,[ visible ] ] ] )Parameterscaption A string that specifies the text associated with the menu item.callbackFunction A function that you define, which is called when the menu item is selected.separatorBefore A Boolean value that indicates whether a separator bar should appear abovethe menu item in the context menu.This parameter is optional; its default value is false.enabled A Boolean value that indicates whether the menu item is enabled or disabled in thecontext menu.This parameter is optional; its default value is true.visible A Boolean value that indicates whether the menu item is visible or invisible.Thisparameter is optional; its default value is true.ReturnsNothing.DescriptionConstructor; creates a new ContextMenuItem object that can be added to theContextMenu.customItems array.ExampleThis example adds Start and Stop menu items, separated by a bar, to the ContextMenu objectmy_cm.The startHandler() function is called when Start is selected from the context menu;stopHandler() is called when Stop is selected.The ContextMenu object is applied to theroot Timeline.342 Chapter 12: ActionScript Dictionary my_cm = new ContextMenu();my_cm.customItems.push(new ContextMenuItem("Start", startHandler));my_cm.customItems.push(new ContextMenuItem("Stop", stopHandler, true));function stopHandler(obj, item) {trace("Stopping.");}function startHandler(obj, item) {trace("Starting.");}_root.menu = my_cm;ContextMenuItem.captionAvailabilityFlash Player 7.UsagemenuItem_cmi.captionDescriptionProperty; a string that specifies the menu item caption (text) displayed in the context menu.ExampleThis example displays the caption for the selected menu item (Pause Game) in the Output panel.my_cm = new ContextMenu();menuItem_cmi = new ContextMenuItem("Pause Game", onPause);my_cm.customItems.function onPause(obj, menuItem) {trace("You chose: " + menuItem.caption);}ContextMenuItem.copy()AvailabilityFlash Player 7.UsagemenuItem_cmi [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • personata.xlx.pl