Thank kenneth. I want to add context menu in text area. Here is the code
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()" >
<mx:Script>
<![CDATA[
import mx.controls.Alert;
[Bindable]
private var cm:ContextMenu;
private var alert:Alert;
private function init():void {
var cmi:ContextMenuItem = new ContextMenuItem("View item...",
true);
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
contextMenuItem_menuItemSelect);
cm = new ContextMenu();
cm.hideBuiltInItems();
cm.customItems = [cmi];
}
private function
contextMenuItem_menuItemSelect(evt:ContextMenuEvent):void {
alert = Alert.show("You just used a custom context menu on a
TextArea.");
}
]]>
</mx:Script>
<mx:TextArea contextMenu="{cm}" />
</mx:WindowedApplication>
I search and see in http://bugs.adobe.com/jira/browse/SDK-17684
seem the bug is not fixed :(
I don't know how to correct it. Can anyone help me!!!
--- In [email protected], "Kenneth Sutherland"
<kenneth.sutherl...@...> wrote:
>
> Try something like
>
> <mx:Canvas
>
> contextMenu="{getyourMenu()}"
>
>
>
> />
>
>
>
> private function getyourMenu () : ContextMenu {
>
> var paste:ContextMenuItem = new ContextMenuItem("paste");
>
> paste.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, pasteHandler);
>
>
>
> var cm:ContextMenu = new ContextMenu();
>
> cm.hideBuiltInItems();
>
> cm.customItems.push(paste);
>
> return cm;
>
> }