-
Senior Member
[AS3] Detecting stage focus lost
sorry if I'm being an awful thickie here, but am trying to work out how to detect that a Flash movie no longer has focus (so i can then pause a game and display a 'click here to re-activate game' message), this is do-able in AS3 isn't it?
Danke,
ChrisError x
-
Professional Air Guitarist
stage.addEventListener(Event.DEACTIVATE, deactivateListener);
There's a weird bug in Safari though. If you're holding down a key and you click on another Safari window the event doesn't trigger, but if you click outside the flash movie in the same window or on the desktop it works fine. Works fine in Firefox when I tried the same thing. Weird.
-
I have it done here without mouse click and works as well, just mouse hovering:
http://www.renderhjs.net/bbs/flashki...une/demo_r112/
using
PHP Code:
stage.addEventListener(Event.MOUSE_LEAVE , leaveFunction);
//and
stage.addEventListener(MouseEvent.MOUSE_MOVE,returnBackCheckFunction);
I just switched a boolean variable between the 2 so I know when the focus is off and when to check for when to switch on back again.
-
Senior Member
yeah thanks guys, have got it working now (athough due to some corner cutting early in my engine, the pause function in my game needs some work)..
thanks for the help, and hopefully will actually be able to show you all my game soon,
x
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|