Highlight text inside a textInput component

Hi!

I’d like to highlight / select text inside a textInput when the user sets the focus on it.
My code (that doesn’t work):


txtInput.text="abcd"; // TextInput text

var txtInputListener:Object = new Object(); // create event listener
txtInput.addEventListener("focusIn", txtInputListener); // set listener

txtInputListener.focusIn=function(){ // focusIn event
txtInput.setSelection(0,txtInput.text.length); // Highlight the inner text
}

Thanks!