Vigor
Vigor

Reputation: 21

flex textinput self defined contextmenu not work

I defined the contextmenu,and add it into button,label,and textinput,but when I right click the textinput component,it dose not work well.but for button, it works.

in textinput it is like the default contextmenu override mine.what I should do to display my menu?

var myContextMenu:ContextMenu=new ContextMenu();
myContextMenu.hideBuiltInItems();
myContextMenu.clipboardMenu=false;

var myContextMenuItem:ContextMenuItem=new ContextMenuItem("tt");
myContextMenu.customItems=myContextMenu.customItems.concat(myContextMenuItem);

how I prevent textinput the focus,stop the selection operate??

Upvotes: 0

Views: 266

Answers (1)

Ilya Zaytsev
Ilya Zaytsev

Reputation: 1055

In flex 4.6 spark TextInput use property textDisplay like:

var myContextMenu:ContextMenu=new ContextMenu();
myContextMenu.hideBuiltInItems();
myContextMenu.clipboardMenu=false;

var myContextMenuItem:ContextMenuItem=new ContextMenuItem("tt");
myContextMenu.customItems=myContextMenu.customItems.concat(myContextMenuItem);
RichEditableText(myInput.textDisplay).contextMenu = myContextMenu;

Upvotes: 1

Related Questions