Apache flex 在当前光标位置从键盘和flex4中程序员自制的键盘插入文本区域?

Apache flex 在当前光标位置从键盘和flex4中程序员自制的键盘插入文本区域?,apache-flex,flex4,flex4.6,Apache Flex,Flex4,Flex4.6,我正在尝试在当前光标位置插入文本。我可以通过键盘在当前光标位置插入文本,但无法通过程序员制作的键盘插入文本。请尝试以下代码:- protected function greekalpha_clickHandler(event:MouseEvent):void { if(FlexGlobals.topLevelApplication.textTarget.visible) { FlexGlobals.topLeve

我正在尝试在当前光标位置插入文本。我可以通过键盘在当前光标位置插入文本,但无法通过程序员制作的键盘插入文本。请尝试以下代码:-

protected function greekalpha_clickHandler(event:MouseEvent):void {     
                if(FlexGlobals.topLevelApplication.textTarget.visible) { 
                    FlexGlobals.topLevelApplication.textTarget.setFocus(); 
                    FlexGlobals.topLevelApplication.textTarget.insertText((event.target as Button).label); 
                } 
            }
var pos:int=taMain.selection激活位置;
如果(位置!=-1)
{
taMain.text=taMain.text.substr(0,pos)+str+taMain.text.substr(pos,taMain.text.length-pos);
taMain.selectRange(pos+str.length,pos+str.length);
}
}
]]>

您能显示您的代码吗?是的,先生。我只是简单地将其连接起来。受保护的函数greekalpha_clickHandler(事件:MouseEvent):void{if(FlexGlobals.topLevelApplication.textTarget.visible){FlexGlobals.topLevelApplication.textTarget.text=FlexGlobals.topLevelApplication.textTarget.text+(事件目标为按钮).label;}}什么是程序员制作的键盘?
            var pos:int = taMain.selectionActivePosition;

            if (pos != -1)
            {
                taMain.text = taMain.text.substr(0, pos) + str + taMain.text.substr(pos, taMain.text.length - pos);
                taMain.selectRange(pos + str.length, pos + str.length);
            }
        }
    ]]>
</fx:Script>