Setting caret (flashing cursor) when focus on text field

Hi all,

I want to have the caret (flashing cursor) to appear when I set the focus to a text field.
It works fine when the user clicks on the text field.

the following does not seem to work for me:

 
stage.focus = mytxtfield
mytxtfield.setSelection(mytxtfield.text.length,mytxtfield.text.length);

When I try this it merely focuses on my text field and no caret comes up!
mytxtfield is the instance name of my input type textfield.

Thank you for taking the time to look at my problem.