Setting Focus on a TextInput inside a ViewStack

I have a Canvas that I add to the stage using the PopUpManager and in this Canvas I have a ViewStack. One of the Canvases inside the ViewStack has an TextInput that I want to set the focus on when the Canvas that was added with the PopUpManager is displayed.

I’m using the code:


I’m calling this method inside an init function that is called after the Canvas is rendered. The result is that I get a blue box around the TextInput, but the cursor does not appear and when I type the focus is never really in the TextInput until I click in it.

I’ve tried calling the setFocus method after several different events are fired on the main Canvas and the Canvas on the ViewStack.

If I pull the TextInput out of the ViewStack it receives focus just fine. It seems to have something to do with the ViewStack itself.

If anyone knows the answer it would be greatly appreciated.