This content has been marked as final. Show 3 replies
Applied CD wrote:
> Here?s the problem: WebXtra appears to steal the window and/or
> keyboard focus when its sprite is initialized. If the user navigates
> to the form and just starts typing nothing happens because as far as
> I can tell the stage and its sprites do not have keyboard focus.
> Clicking anywhere on the stage restores focus and everything behaves
> normally but that extra click shouldn?t be necessary. I?ve tried
> forcing keyboard focus to the first text sprite everywhere
> and it
> doesn?t seem to help. I?ve also tried baActivate(baWinHandle()) to
> force focus to the stage and that doesn?t work either. The only thing
> that does work is to type _moive.keyboardFocusSprite = 93 (the first
> text sprite) into the message window and suddenly everything is back
> to normal.
Assuming the WebXtra sprite is in a lower-numbered channel than the sprite
you want focused on, can't you just use
on the first text member sprite?
If that's how you meant isn't working, then perhaps you need to delay
setting the focus, either by counting a couple of frames in an enterFrame
handler, or by using a timeOut object.
The way you solved it is actually the way I solved it too, I never figured out a way to get it to work another way...
I tried putting _movie.keyboardFocusSprite=<spriteNum of 1st text field> in a number of different locations: in the beginSprite handler for the first text field (as in your example), in the beginSprite handler for the webxtra sprite, in exitFrame and enterFrame handlers one frame after all sprites have been initialized, and as tests (these tests will would disable all text input except the first field): in the exitFrame loop holding the play head on the frame and on both the exitFrame and enterFrame handlers of the webxtra sprite itself. None of these work, and it doesn’t seem to matter whether the WebXtra sprite channel is higher or lower than the text fields (although logically it would be better to initialize webxtra first (lower channel)). I didn’t try the timeout script, however, the last two tests I described should be constantly issuing a change of focus to the first text sprite so I don’t see how timing could be an issue.
I’m not sure but I think once the webxtra sprite initializes keyboard focus is passed to the browser window in the sprite and is no longer under Director control until a mouse click on the stage brings it back.