1 decade ago by Blammo
I'm having an unusual issue with impact whenever I have the canvas running from within an iframe and I bind the left mouse button to an action. I think I might know what's causing it too.
Currently I'm writing a game that involves a few keyboard actions and the mouse, and it runs inside an iframe for reasons I won't go into. Running it outside the iframe isn't an option, sorry. =/
If the game starts inside the iframe, it doesn't have focus, so none of the keys work, which is fine because you only see the title screen until you click something anyway. Normally, I can select the iframe with the left mouse button which will focus it and make everything work If I bind the left mouse button to an action in the game, though, the focus doesn't happen, so the mouse action works but none of the keyboard actions do.
No matter what I do, I can't focus the canvas. I've even tried calling .focus() on it inside my game code on the mouse button action, but that doesn't work either.
Any ideas? (Don't say don't run it in an iframe ¬_¬ )
Currently I'm writing a game that involves a few keyboard actions and the mouse, and it runs inside an iframe for reasons I won't go into. Running it outside the iframe isn't an option, sorry. =/
If the game starts inside the iframe, it doesn't have focus, so none of the keys work, which is fine because you only see the title screen until you click something anyway. Normally, I can select the iframe with the left mouse button which will focus it and make everything work If I bind the left mouse button to an action in the game, though, the focus doesn't happen, so the mouse action works but none of the keyboard actions do.
No matter what I do, I can't focus the canvas. I've even tried calling .focus() on it inside my game code on the mouse button action, but that doesn't work either.
Any ideas? (Don't say don't run it in an iframe ¬_¬ )