stage.focus = this;
Place this on the main timeline in order to set the focus to your Flash movie. Focus refers to the currently active object in your Flash movie. Whenever you click on something, like a MovieClip or a TextField, it becomes the active object and becomes the object that is in focus. Here, we are setting the focus back to the entire Flash movie without having to click on anywhere inside the movie. This way, the keyboard events that you've created will work right away. I've encountered this problem a couple of times and I was able to solve them by adding this line. However, adding this line might cause a yellow border to appear around the object that is in focus. If that happens, then try adding this line before the stage.focus statement:
stage.stageFocusRect = false; stage.focus = this;
That yellow border is the stage focus rectangle which serves to highlight the object that is currently in focus. Here, we're setting the stageFocusRect property to false so that the border will not show up.
thanks a lot
ReplyDeleteThanks for the tip. This is exactly what I was looking for!
ReplyDeleteOh my word, I've been looking forever to solve this problem, I owe you <3
ReplyDeleteawesome! thank you so much!!
ReplyDeleteTHANK YOU SO MUCH !!
ReplyDeleteIn firefox version 17 first click won't work need to click again then only it accept keyboard event. pls help me.
ReplyDeleteThanks in advance