jeudi 17 novembre 2016

How to add Custom Context Menu to Text Area Control in ActionScript 3?

I an using the following codes to declare Text Area:

<s:TextArea id="txtArea" width="{this.width}" height="{this.height}" borderVisible="false" focusAlpha="0.01" selectionHighlighting="always" styleName="scrollableText"needsSoftKeyboard="true" focusRect="false" direction="{textBoxDirction}" buttonMode="true" useHandCursor="true" mouseChildren="true"/>

I want to add a Custom Context Menu to this Text Area and to add Custom Context menu i am using following codes:

var contextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
contextMenu.clipboardMenu = false;
contextMenu.addItem(new ContextMenuItem("Start Select"));
contextMenu.addItem(new ContextMenuItem("Start Copy"));

txtArea.contextMenu = contextMenu;

But my problem is that after adding this also in first right click i am getting the default Context Menu, i.e enter image description here

And from second right click i am getting the Custom Context Menu, i.e enter image description here

I am unable to know why i am not getting the Custom Context Menu from first right click.

So if anybody can find where i am doing wrong or how to resolve this problem please help me to solve.

Aucun commentaire:

Enregistrer un commentaire