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>