Focus works (at times)

Hello,

I am having problem managing textfield focus. When the interactive first launches there is a button that the user must click to get started. When they do that the focus is forced into the txtInput text field. Good.

But if the SWF looses focus, and then gains focus again, I can not seem to force focus to the txtInput text field again. Actually, it does seem to have focus since it accepts text, but the cursor is not there. Bad.

It’s the same code, why does it not work? The only real difference is the fact that I do a remove child in one and not the other. Does it make a difference that it is not embedded in an html page when I am testing it?


function handleDirections(evt:MouseEvent):void
{
 this.removeChild(mcDirections);
 
 stage.focus = txtInput;
 txtInput.text = "$";
 txtInput.setTextFormat(formatHilite);
 txtInput.setSelection(txtInput.text.length,txtInput.text.length);
 txtInput.text = "";
   
 txtInput.addEventListener(KeyboardEvent.KEY_DOWN,handleKeyPress);
 btnReset.addEventListener(MouseEvent.CLICK, handleReset);
}
function windowActive(evt:Event):void
{
 txtInput.width = 38;
 txtInput.autoSize = TextFieldAutoSize.LEFT;
 
 stage.focus = txtInput;
 txtInput.text = "$";
 txtInput.setTextFormat(formatHilite);
 txtInput.setSelection(txtInput.text.length,txtInput.text.length);
 txtInput.text = "";
}