Респект флеш мастерам
Вот, есть код(AS2) добавления в скобки выделенного текста из TextField,
помогите переписать под ActionScript 3.0
txt - name TextField
tr - button

Код AS1/AS2:
txt.onSetFocus = txt_onSetFocusHandler;
txt.onKillFocus = txt_onKillFocusHandler;
tr.onRelease = tr_onReleaseHandler;
var beginIndex:Number;
var endIndex:Number;
function txt_onSetFocusHandler(oldFocus:Object):Void
{
onMouseUp = onMouseUpHandler;
}
function txt_onKillFocusHandler(newFocus:Object):Void
{
delete onMouseUp;
}
function onMouseUpHandler():Void
{
beginIndex = Selection.getBeginIndex();
endIndex = Selection.getEndIndex();
}
function tr_onReleaseHandler():Void
{
if (beginIndex == endIndex)
return;
var newString:String = '(' + txt.text.substring(beginIndex, endIndex) + ')';
txt.replaceText(beginIndex, endIndex, newString);
delete beginIndex;
delete endIndex;
}