Saturday, February 13, 2010

Flex Activate / Deactivate Events on OS X

In JamLegend, it would be nice to auto-pause the game when the user switches focus to another application. You'd think it would be very simple to detect if Flash player currently has focus, but the recommended methods are unreliable cross-platform.

Findings (so far)
  • Chrome, Firefox, and Safari receive activate and deactivate events if the browser loads the SWF directly, but NOT if the SWF is loaded inside of an HTML page.
  • The method of loading the SWF is inconsequential; e.g. JavaScript vs. HTML tags.
  • When the SWF is loaded directly, activate is not dispatched when re-focusing on the browser by clicking the flex app; a second click is required.
This is really a pain. One suggested hack is to look for the MOUSE_LEAVE event (when the user moves the mouse off of the flex app). That works well when UI elements are draggable and you need to handle the case of the mouse leaving the flex app while dragging, but it isn't a valid indicator of whether the flex app still has focus. For example, in JamLegend, the user can move the mouse anywhere and they can still play as long as the flex app has focus (thus receiving key events).

There might be a big hack somewhere, utilizing activate and deactivate events for Windows, plus a combo of JavaScript focus events and mouse position for OS X, but I haven't figured it out yet...

System Details
  • OS X 10.6.2
  • Flash Player 10,0,42,34
  • Chrome 5.0.307.7 beta
  • Safari 4.0.4
  • Firefox 3.5.5.

Resources

42 comments:

Anonymous said...

This website has very good content. so I am sure this website will form the well-known in the future. visit here

Anonymous said...

This info is very helpful for me with my project time and thanks you very much for using the valuable info in this blog. suplemen pelangsing tubuh

baju wanita said...

This is one of the best blogs I have ever read. I m absolutely excited to get to read such a well blog. I would love to read more of your blogs. Thanks dude

mas jangkrik said...

Hello, i am glad to read the whole content of this blog and am very excited and happy to say that the webmaster has done a very good job here to put all the information content and information at one place. visit here

mas jangkrik said...

Thanks for sharing this great article, After reading the article, I feel that I need more information on the topic.http://www.jinglesparty.com

mas jangkrik said...

You've written nice post, I am gonna bookmark this page, keep your post anion

Anonymous said...

I am often to blogging and i really respect your content. click here

Anonymous said...

Iam very happy for read....Nice Article And Have A Good Luck. Keep Post More About This. jual crocs terbaru

mas jangkrik said...

You've written nice post, I am gonna bookmark this page, thanks for info. visit here

mas jangkrik said...

I really fun with your Blog, I would like more information about this, because it is very nice., Thank You sewa mobil jogja

mas jangkrik said...

Amazing, this is a great article! I did enjoyed reading it, keep your post :) tas kulit terbaru

mas jangkrik said...

I love your blogs, Thanks for the nice post. I have already bookmarked it click here :D

mas jangkrik said...

Thank you for the great article I did enjoyed reading it, I want to encourage that you continue your great job, have a good day. paket umroh murah

mas jangkrik said...

I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. jual produk kecantikan

rental mobil solo said...

Wow amazing, Nice content I found so many interesting stuff in your blog especially its discussion Thanks to sharing thanks!

sepatu crocs asli said...

Awesome information, Any way I'll be subscribing to your feed and I hope you post again soon. Keep Blogging

social bookmarking service said...

Your post is so cool,...I appreciated your professional way of writing this post.

Reverse Osmosis said...

This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion

mas jangkrik said...

I am very happy to read this. This blog was really an awesome site, Continue blogging new and entertaining posts. click here

Slamet Obama said...

Iam very happy to reading, Hope you continue to share your information more penghilang jerawat murah :)

Anonymous said...

Very nice post. I just stumbled upon your weblog and wished to say that I have truly enjoyed browsing your weblog posts. Thank you rental mobil solo

Slamet Obama said...

A good example of content presentation. Thanks for sharing this information. Keep blogging. click here

Slamet Obama said...

Nice artcle, very informative....... thanks for sharing . pusat parcel murah

Jual Duo Berry said...

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Thanks

bunga papan bengkulu said...

I would like to apprentice at the same time as you amend your site, how can i subscribe for a weblog site?

John Slondok said...

I needed to thank you for this excellent information!! I have bookmarked your blog to check out the new stuff you post. florist bandung

aneka resep kue basah said...

good idea and helpfull for us resep kue

karya ismail said...

This is a great article, Thanks for giving me this information. Keep posting
Furniture Jepara :
Mebel Jepara :
Furniture Jepara Murah :
Furniture Minimalis :
Furniture Jati Jepara :
Furniture Online :
Furniture Jati Jepara :
Furniture Murah :
Furniture Kursi :
Furniture Jati Jepara :
Karya Priboemi Jepara :
Furniture Kursi Jati :
Furniture jepara Online :
Furniture Online jepara :
Furniture Meja :
Furniture Online :
Kamar Set Minimalis
Kursi Tamu Mewah
Meja Makan Jati Jepara
Tempat Tidur Jati Jepara
Mebel Jati Jepara
Mebel Jepara
Kamar Set Jati

High School Diploma Online said...

Really well created work you have shared here thanks a lot.

Anonymous said...

I really admire the important ideas that you offer in the content. I am looking forward for more important thoughts and more blogs. Thanks Click here

Online High School Program said...

I must say that while reading your post.

John Slondok said...

You have some really great posts and I feel I would be a good asset. Thank you Sir grating cast iron

manhole cover said...

Thanks for sharing such a wonderful post. Very much informative post. Hope to see such kind of post more and more

Pusat Les Privat said...

This is really wonderful website. If you need this rental mobil di Pare and also you can find this Les privat guru ke rumah siswa di Surabaya

Maria said...

Excellent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and please keep it up. Click Here

jual membran ro said...

Thank you for publishing such an excellent article!

florist di surabaya said...

It's always nice when you can not only be informed,
but also entertained! I'm sure you had fun writing this article.

karangan bunga jakarta said...

This post is pretty interesting. Inspiring, as well. Keep post n wait for other articles : )

buy virgin coconut oil said...

I love your site, I am so much excited after reading your blog. Your blog is very much innovative and much helpful for any, Thank you

xjd7410@gmail.com said...

insanity workout
louis vuitton outlet stores
adidas originals
michael kors outlet
coach factory outlet
replica watches
toms shoes
gucci handbags
louis vuitton handbags
coach outlet store online
timberland outlet
louis vuitton handbags
kate spade outlet
oakley sunglasses
oakley sunglasses
cheap jordans
oakley vault
burberry bags
air jordans
coach outlet store online clearances
beats solo 2
lebron james shoes
coach outlet store online
tory burch outlet
adidas ultra boost
cheap ray ban sunglasses
hollister shirts
ralph lauren polo
coach outlet store online clearances
chenyingying20160806

Pusat Les Privat said...

Your website is really good website.
Please Visit my website
guru les privat ke rumah siswa di Surabaya
les privat di Surabaya guru ke rumah siswa
les privat semua pelajaran di Surabaya

My blog said...

Your website is really amazing.
Please Visit my website
kumpulan materi bahasa Inggris lengkap
Pentingnya grammar dalam bahasa Inggris
Tenses adalah materi pokok dalam grammar bahasa Inggris
Part of speech materi grammar bahasa inggris
Tenses present tense
grammar tenses Past tense