Простой, как:
protected function richText_keyDownHandler(event:KeyboardEvent):void
{
if (event.keyCode == 66) //or remove if statement
richText.insertText("Really?");
}
<s:RichEditableText id="richText" text="Lorem ipsum dolor sit amet"
keyDown="richText_keyDownHandler(event)"/>
EDIT: для тх RichTextEditor
protected function richText_keyDownHandler(event:KeyboardEvent):void
{
var ind:int = richEdit.selection.beginIndex;
richEdit.text = richEdit.text.substring(0, ind) +
"Your text variable here" +
richEdit.text.substring(ind, richEdit.text.length);
}
и тх богатый текстовый редактор:
<mx:RichTextEditor id="richEdit" text="Lorem ipsum dolor sit amet"
keyDown="richText_keyDownHandler(event)"/>
Возможно, есть более эффективный метод, но это единственное, о чем я мог думать.
Спасибо, но с помощью
Flex60460
Я обновил код, который вам подойдет. – randomUser56789
Большое спасибо. Это хорошо работает! – Flex60460