Re: SWF losing focus problem
I believe that the .swf doesn't have the focus at the beginning, that's probably why the MMF generated HTML file says "MMF Flash Application. Click on the Application to set the focus.".
I have reported this not so long ago:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=245676#Post2456 76
Re: SWF losing focus problem
I was trying some javascript to give SWF files focus when a page loaded but I got tired of browsers all being different.
Re: SWF losing focus problem
The confusing thing here is that the code that looks for this condition is not the initial frame. I have a title screen frame that loads before it and requires a mouse click or keyboard button press to load the game frame. So, the game frame only loads based on the swf having focus (since you can't start the game frame without some input). It seems odd that the focus would be reset to false at the start of every frame, no?
Is there some workaround that someone can suggest so that the condition check is ignored for one frame at the start of frame? Or can I force focus somehow?
Re: SWF losing focus problem
I can confirm the problem described by mobichan. I have a similar setup, a game with first a main menu where you have to click to play, and then a level where I test if the application has the focus, if not activate pause.
Sometimes the pause activates right at the beginning of the level, yet I have clicked in the game window at least once.
This doesn't happen everytime though. I can't tell why it happens but I was about to remove the code (since I am ).
I am sure that it happens offline when I build/launch the app from MMF. But I have yet to make sure that it happens online on a server/webpage.
Also I wonder if another (control?) object contained in the application could "steal" the focus of the application?
Re: SWF losing focus problem
I am also noticing that different browsers return focus differently when the swf page is loaded. Firefox seems to register the app is focused when it loads the page, but IE loads the swf page unfocused. T_T
Also, running in debug has the annoying issue of focus being lost when you click on the debugger. Not sure if there is a workaround for this, but it usually means I have to disable all the focus related code when testing the game. And I need to build and run the swf when I want to really test this functionality.
Re: SWF losing focus problem
My IE9 registers focused upon loading.
Marv
Re: SWF losing focus problem
So, I am running into another focus issue, where having a button seems to be messing up the swf focus. I have a button that is created at runtime and I can not press it for some reason. It never registers a press. What is odd is that it only has this problem on the frame with the flash object in it. Other frames with no Flash object have working buttons.
I swear this button worked for a long time, but as of today, it seems to be unclickable. Any ideas?
Re: SWF losing focus problem
Curiously enough, I've had a similar problem. Mine seemed to be a side effect of the Sandy3D object.
My only workaround was to make the button an active.
Re: SWF losing focus problem
Thanks RickyRombo. I was afraid of that, but at least it isn't hard to convert it. I just need to adjust all my "On button clicked" code. T_T
If this is a bug, hopefully it can be fixed in the future.
Re: SWF losing focus problem
So, now that the button is an active object, I am running into the same problem. But I think the issue is having an edit text field that is gaining focus. It seems that once you lose focus to a text field, you can't get it back whatsoever.
My setup is to have an active object that allows you to click on it once you have typed in your initials. But after the focus has been given to the edit box (for typing) you are stuck.
Ideas?
Re: SWF losing focus problem
Turns out the problem was the FlashFx beta extension. I reinstalled B252 and everything seems to work exactly as expected.