发货:3天内
详细说明
在平时的Flex组件开发过程中遇到的问题:怎么在textarea的光标位置插入字符?
解决办法总结如下:
<mx:textarea id="textEditor" x="11" y="366" width="399"/>
private function insertString(insertStr:String):void
{
if (this.textEditor.selectionBeginIndex == this.textEditor.selectionEndIndex)
{
var startPart:String=this.textEditor.text.substrin(0, this.textEditor.selectionBeginIndex);
var endPart:String=this.textEditor.text.substrin(this.textEditor.selectionEndIndex, this.textEditor.text.length);
startPart+=insertStr;
startPart+=endPart;
this.textEditor.text=startPart;
}
else
{
this.textEditor.text=insertStr;
}
}
更多相关产品资讯可以查询:flex 组件http://bbs.9ria.com/thread-75487-1-1.html