Thank Steve very much. I find out the link but I don't know how to follow it. 
Now I can add more context menu :) 

--- In flexcoders@yahoogroups.com, "valdhor" <valdhorli...@...> wrote:
>
> Is there any reason you can't use the workaround they suggest in Jira?
> 
> Main Application:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> creationComplete="init()" xmlns:custom="*">
>      <custom:myTextArea/>
> </mx:Application>
> 
> 
> myTextArea.as:
> package
> {
>      import flash.events.ContextMenuEvent;
>      import flash.text.TextField;
>      import flash.ui.ContextMenu;
>      import flash.ui.ContextMenuItem;
>      import mx.controls.Alert;
>      import mx.controls.TextArea;
> 
>      public class myTextArea extends TextArea
>      {
>          private var cm:ContextMenu;
>          private var cmi:ContextMenuItem;
> 
>          public function myTextArea()
>          {
>              super();
>              callLater(addCTMenu);
>          }
> 
>          private function addCTMenu():void
>          {
>              cmi = new ContextMenuItem("View item...", true);
>              cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
> contextMenuItem_menuItemSelect);
>              cm = new ContextMenu();
>              cm.hideBuiltInItems();
>              cm.customItems = [cmi];
>              (textField as TextField).contextMenu = cm;
>          }
> 
>          private function
> contextMenuItem_menuItemSelect(evt:ContextMenuEvent):void
>          {
>              Alert.show("You just used a custom context menu on a
> TextArea.");
>          }
>      }
> }
> 
> NB: The reason I used callLater was that the textField was not
> instanciated when the textArea was first created.
> 
> 
> HTH.
> 
> 
> Steve


Reply via email to