[flexcoders] focus out of the flash player
I have a requirement to dismiss a dialog if the flash player loses focus (e.g. someone clicks outside of the player). I'm using the Flex 2.0.01 SDK (hotfix 3) with IE 7 and Flash Player 9. I've registered a FOCUS_OUT event handler on the stage. That seems to work, but I've run into a case where the event is ambiguous. I've been keying off of if (event.relatedObject == null) //then assume the player's lost focus. The problem is that if my dialog contains a DropDown and the DropDown is opened, then I'm getting an event that also has a null value for relatedObject. I don't want to close the dialog if someone opens a DropDown :-) I've also tried focus-out handlers on the root and the dialog window objects (my dialog is subsclass of TitleWindow), but they have a similar result. Any suggestions? Is there another sort of event that will tell me when the Player has lost focus to the browser or another app? Thanks, Glenn
RE: [flexcoders] focus out of the flash player
DEACTIVATE event is better From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Glenn Jones Sent: Friday, June 20, 2008 6:10 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] focus out of the flash player I have a requirement to dismiss a dialog if the flash player loses focus (e.g. someone clicks outside of the player). I'm using the Flex 2.0.01 SDK (hotfix 3) with IE 7 and Flash Player 9. I've registered a FOCUS_OUT event handler on the stage. That seems to work, but I've run into a case where the event is ambiguous. I've been keying off of if (event.relatedObject == null) //then assume the player's lost focus. The problem is that if my dialog contains a DropDown and the DropDown is opened, then I'm getting an event that also has a null value for relatedObject. I don't want to close the dialog if someone opens a DropDown :-) I've also tried focus-out handlers on the root and the dialog window objects (my dialog is subsclass of TitleWindow), but they have a similar result. Any suggestions? Is there another sort of event that will tell me when the Player has lost focus to the browser or another app? Thanks, Glenn
Re: [flexcoders] focus out of the flash player
Much better :-) The DEACTIVATE had none of the ambiguity of the FOCUS_OUT. I still had a problem simply closing the dialog when an item-editor was active - seems like there were events still queued which would NPE when they fired after the controls had been deleted. But I worked around that by using the deactivateHandler to raise a flag that told focusOutHandler when it was safe to act. Thanks, - Glenn On Fri, Jun 20, 2008 at 1:56 PM, Alex Harui [EMAIL PROTECTED] wrote: DEACTIVATE event is better -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Glenn Jones *Sent:* Friday, June 20, 2008 6:10 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] focus out of the flash player I have a requirement to dismiss a dialog if the flash player loses focus (e.g. someone clicks outside of the player). I'm using the Flex 2.0.01 SDK (hotfix 3) with IE 7 and Flash Player 9. I've registered a FOCUS_OUT event handler on the stage. That seems to work, but I've run into a case where the event is ambiguous. I've been keying off of if (event.relatedObject == null) //then assume the player's lost focus. The problem is that if my dialog contains a DropDown and the DropDown is opened, then I'm getting an event that also has a null value for relatedObject. I don't want to close the dialog if someone opens a DropDown :-) I've also tried focus-out handlers on the root and the dialog window objects (my dialog is subsclass of TitleWindow), but they have a similar result. Any suggestions? Is there another sort of event that will tell me when the Player has lost focus to the browser or another app? Thanks, Glenn