Action Script Set Focus
I have a KeyboardEvent.KEY_DOWN event listener on frame 10 and on the first frame a button which when clicked takes you to frame 10, if you add gotoAndPlay(10); on the top of frame 1 the event listener works fine, if you click the button to get to frame 10 you have to click somewhe开发者_Go百科re in the frame before the event listener works..
Any ideas?
D.
You can use the stages focus property to set the keyboard focus to an interactive object.
stage.focus = stage;
In addition to TandemAdam's suggestion of shifting focus, you can register your events at the stage level. For example, call stage.addEventListener(...)
.
EDIT: Posted this right before I read your comment, Dean Bayley. It seems like you're already doing what I suggested, and in that case I can't reproduce your problem--it works fine on my machine.
精彩评论