Подскажите как привязать ContextMenu к TextInput ???
Ставлю так
Код:
<?xml version="1.0" encoding="utf-8"?>
<s:Application name="Spark_Application_contextMenu_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
initialize="init();" xmlns:mx2="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
private var cm:ContextMenu;
private function init():void {
var showSelection:ContextMenuItem = new ContextMenuItem("Show selection");
showSelection.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, showSelection_menuItemSelect);
cm = new ContextMenu();
cm.hideBuiltInItems();
cm.customItems.push(showSelection);
myTextInput.ContextMenu = cm;
}
private function showSelection_menuItemSelect():void {
txt.visible = true;
}
]]>
</fx:Script>
<s:TextInput
x="422"
y="270"
width="300" text="Hello Sergi, How are you ? :)" id="myTextInput" />
<s:Label id="txt" visible="false" x="333" y="275" text="Text here >" width="93" fontStyle="normal" fontWeight="bold" fontSize="16"/>
<s:Button x="259" y="269" label="Кнопка"/>
</s:Application>
Не работает !