I'm going to answer the question I think you're meaning to ask.
What you want to do is have Flash run in the background when you've lost focus. This is a big problem with Flash-based idle games, and the following are some bits from Adobe's Flash Administration Manual that should make stuff run when you aren't focused.
mms.cfg file location Assuming a default Windows installation, Flash
Player looks for the mms.cfg file in the following system directories:
• 32-bit Windows - %WINDIR%\System32\Macromed\Flash
• 64-bit Windows - %WINDIR%\SysWow64\Macromed\Flash
What you want to do is create this mms.cfg file (you'll need admin access, natch) with the following lines in it:
ProtectedMode=0
FullFramerateWhenInvisible=true
I recall disabling protected mode being necessary, even though its stated purpose is sandboxing Flash apps - for whatever reason, the other option didn't work without it. YMMV, of course - try it without disabling protected mode first - it's been a long while since I've configured this on my computers.
FullFramerateWhenInvisible is the option that makes it so Flash runs when the window doesn't have focus.
Once again, this isn't the specific question you asked, but if it isn't the right answer, it'll at least send you in the right direction. :)
Reference:
Admin guide: http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html
Framerate trick: http://tukkun.webs.com/ (#3 on that webpage, currently)
@harrymc Javascript only is ok. – alecail – 2013-10-12T10:53:32.577
1Need a demo url for giving useful advice. – harrymc – 2013-10-12T10:55:59.397