The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 ViewsI got a little problem with my game that I am about to create.
The game got two frames: a titleframe and a play frame (which is the actual game). On the titleframe I got a button that leads to the playframe. When I click it everything seems to work: I get to the playframe and everything runs. Tho it seems that the keybord inputs wont work until I click on the screen with the mousepointe once more. I cant move my character and I cant fire any bullets, but when I click anywhere on the screen once everything runs.
What can the problem be? Have never seen it before. Any suggestions? (sorry for a bad explanation)
Check out the coolest Donkey Kong Game on NG!
http://www.newgrounds.com/portal/vi ew/459064
100 posts @ Posted at: 9/15/08 07:36 AM http://www.newgrounds.com/bbs/topic /969232
this has to do with the stage's focus. To prevent this, you can use something like this:
[code]
addEventListener(FocusRequestEvent.REQUE ST_FOCUS, focusRequestHandler);
private function focusRequestHandler(e:FocusRequestEvent)
:void {
stage.focus = InteractiveObject(e.target);
}
[/code]
At 3/13/10 01:24 PM, BasV wrote: this has to do with the stage's focus. To prevent this, you can use something like this:
Oops! I accedentally gave you the wrong code from my project, that code is used by classes that actively want to request focus. If you want the focus to go to the stage after any mouse click, you can listen to a MouseEvent.MOUSE_DOWN Event instead, and do something like:
[code]
private function mouseDownHandler(e:MouseEvent):void {
stage.focus = stage;
}
[/code]
that way, the focus always returns to the stage. You might want to make sure the mouse events of other classes are handled before this event though.
At 3/13/10 01:27 PM, BasV wrote:At 3/13/10 01:24 PM, BasV wrote: this has to do with the stage's focus. To prevent this, you can use something like this:Oops! I accedentally gave you the wrong code from my project, that code is used by classes that actively want to request focus. If you want the focus to go to the stage after any mouse click, you can listen to a MouseEvent.MOUSE_DOWN Event instead, and do something like:
[code]
private function mouseDownHandler(e:MouseEvent):void {
stage.focus = stage;
}
[/code]
that way, the focus always returns to the stage. You might want to make sure the mouse events of other classes are handled before this event though.
Thank you BusV, great information. I have read the book ACtionscript 3.0 game programming university, but cant remember that this was mentioned anywhere =) Thank you
Check out the coolest Donkey Kong Game on NG!
http://www.newgrounds.com/portal/vi ew/459064
100 posts @ Posted at: 9/15/08 07:36 AM http://www.newgrounds.com/bbs/topic /969232