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.



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.

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

Anonymous 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

Anonymous said...

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

Anonymous 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?

Anonymous 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.

Anonymous 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

Anonymous 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 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

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

starfall said...

Thank you for your sharing! I really like to read it,So good to find somebody with some original thoughts on this subject .
abcya |abcya 7 | brainpop

aaa kitty20101122 said...

adidas nmd r1
nike huarache
yeezy shoes
michael kors purses
lebron james shoes
kyrie shoes
jordan shoes
air yeezy
longchamp bags

aaa kitty20101122 said...

michael kors outlet store
true religion jeans
air jordan
michael kors outlet
mlb jerseys
fitflops clearance
adidas superstar shoes
tory burch shoes
tory burch shoes
michael kors handbags

aaa kitty20101122 said...

adidas nmd
air jordans
adidas tubular
golden goose
air max 2016
true religion outlet
kobe shoes
nike polo
jordan 11 retro

dong dong23 said...

cheap nfl jerseys
michael kors geldbeutel
ferragamo outlet
fitflops shoes
north face outlet
canada goose sale
rolex online store
cheap jordan shoes
coach factory outlet
cheap uggs

mohamed mohsan said...

19058صيانة توشيبا

صيانة سامسونج
صيانة توشيبا

صيانة غسالات سامسونج
صيانة ثلاجات كريازي
صيانة ثلاجات توشيبا

صيانة سامسونج
صيانة توشيبا
صيانة غسالات توشيبا
صيانة ثلاجات توشيبا
صيانة كريازي

صيانة سيمنس
صيانة سخانات سيمنس
صيانة غسالات كريازي
رقم صيانة سيمنس
اسعار تكييف يونيون اير
مبيعات يونيون اير
تكييف يونيون اير

Alice Taylor said...

Thank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me

Coco Love said...

I realize that nothing is fair but I'm still trying. I just want to do my best and what is possible

Games 2 Girls said...

Thanks for sharing the information. It is very useful for my future. keep sharing

David Jones said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog.
Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Online Training from India .
or learn thru JavaScript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

Les privat Jogja said...

Thanks for sharing this. I am glad to find this and it is very interesting.
Please visit this
Les privat guru ke rumah siswa di Jogja
les privat di Jogja guru ke rumah siswa
Guru les privat datang ke rumah siswa di Jogja

洛噷 said...

2018625 leilei3915
mcm outlet
adidas ultra boost
michael kors outlet online
pandora charms sale clearance
valentino shoes
red bottom shoes
mlb jerseys
uggs outlet
coach outlet
pandora jewelry

洛噷 said...

2018625 leilei3915
michael kors outlet online
asics shoes
coach outlet
christian louboutin outlet
moncler jackets
christian louboutin sale
michael kors outlet clearance
ray ban sunglasses outlet
canada goose jackets
polo ralph lauren outlet

harish sharma said...

lucky patcher

lucky patcher apk

lucky patcher download

chenlili said...

ray ban
pandora jewelry
omega watches
oakley sunglasses
levi jeans
soccer jerseys
ugg for kids
montblanc pen
camisetas de futbol



洛噷 said...

2018930 leilei3915
mont blanc
pandora charms sale clearance
michael kors outlet online
canada goose jackets
fitflop sandals
ray bans
mbt outlet
supreme clothing uk
polo ralph lauren
pandora charms sale clearance

dong dong23 said...

louboutin pas cher
carson wentz jersey
beats pill
ed hardy
yves saint laurent
adidas outlet
vans shoes
beats by dre
kobe 9