テキスト、フォーカス取得時に全選択

フォーカスを受け取ったイベントと同時に選択できない。
タイマーつかって時間差で選択する。


as2

_txt.onSetFocus = function(oldFocus:Object) {
  var timer:Number = setTimeout(selectText2, 200);
};
function selectText2() {
  Selection.setFocus("_txt");
  Selection.setSelection(0,_txt.text.length);
}

as3

var myTimer:Timer = new Timer(2, 1);
myTimer.addEventListener(TimerEvent.TIMER, timerHandler);
_txt.addEventListener(FocusEvent.FOCUS_IN, selectText);
function selectText(e:FocusEvent):void {
  trace("a");
  myTimer.start();
}
function timerHandler(e:Event){
  _txt.setSelection(0, _txt.length);
}