How to set a focus on a flash game?

Monkey Targets Forums/Flash/How to set a focus on a flash game?

Vinians(Posted 2011) [#1]
The flash game window always appears unfocused. Is there any way to set focus in the window?


Volker(Posted 2011) [#2]
Are you using and any Print commands?
The canvas looses focus if Print (output to concole) is used.


slenkar(Posted 2011) [#3]
I dont think its possible to do from monkey or as3
you just have to click the game


therevills(Posted 2011) [#4]
The canvas looses focus if Print (output to concole) is used


BTW The Print command in Flash "prints" on the game "canvas" not in a console.


Farflame(Posted 2012) [#5]
Just started with Flash and noticing the same thing. Does this happen all the time? It's a bit confusing if your game says 'Hit Space to Start' and nothing happens when you hit space. Isn't there a solution to it other than clicking on the window?


skid(Posted 2012) [#6]
All flash games are click to start because of this focus issue.

As a developer you can get round it with html tricks, but don't expect your host / portal / publisher to want to implement such things, hence click to start...


Soap(Posted 2012) [#7]
You can disable the console in Flash by editing \modules\monkey\native\lang.as line 21



Detect if the game has focus and if not then display some kind of notification to tell the user to click on the game to give it focus.


Farflame(Posted 2012) [#8]
Could you tell me which program you use to edit .as files? Will I need to install loads of Flash stuff or is there a simple editor?


skid(Posted 2012) [#9]
Any text editor will do including Monk.


Farflame(Posted 2012) [#10]
I think I had a problem with Windows. It was only showing 'Open' for files or 'Open with...' only when it knew the extension. Normally you can choose notepad from 'Open with' but if it didn't know the extension the option was gone. So I had to go into the registry to allow me to use Notepad for any file, which is now working, so I can edit with Notepad now. Just what I need when I'm struggling, Windows going stupid on me :p


Soap(Posted 2012) [#11]
http://notepad-plus-plus.org/


Farflame(Posted 2012) [#12]
Ooh, wierd coincidence. I just searched for Notepad to get help with this problem of it not showing up for 'Open with...' and I ended up on that page. Didn't really read it because I was just looking for help with that problem, but didn't realise it was a nifty new Notepad. Have just installed it - not only is it much better, it would have solved my first problem because it does come up on the menu xD