here's the code i run...
on the TitleWindow i set the keyUp to the func
<mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml" keyUp="this_keyUp()">
//here's the code 4 the func
private function this_keyUp()
{
if (Key.getCode() == Key.ESCAPE) this.deletePopUp();
}
Disclaimer:
Matt Chotin has helped me with almost every problem I've posted here. *Thanks for that Matt*
I'm not sure I've ever gotten IE to pass the escape key through to the Player unfortunately.
Matt
From: [email protected] [mailto:[email protected]] On Behalf Of Allen Manning
Sent: Wednesday, July 20, 2005 9:45 AM
To: [email protected]
Subject: [flexcoders] Closing Title Popup with [Escape], works in Mozilla but not IE??
Hello Flexcoders,
I can close the pop-up with the Escape key in Mozilla but not IE. Any ideas?
Index.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
private function openPopup():Void
{
/*
createPopUp(parent:MovieClip, class:Object [, modal:Boolean, initobj:Object,outsideEvents:Boolean]) : MovieClip
*/
var model:Boolean = true;
var myWin_mc = mx.managers.PopUpManager.createPopUp(this,TitleWindow,model);
//center of this mc
myWin_mc.centerPopUp();
//Create the event handler to delete the pop up when closed
var eventHandlerObj = new Object();
eventHandlerObj.click = function(event)
{
event.target.deletePopUp();
}
//Register the event handler with the TitleWindow container.
myWin_mc.addEventListener("click",eventHandlerObj);
}
</mx:Script>
<mx:HBox>
<mx:Button click="openPopup()" label="Open"/>
</mx:HBox>
</mx:Application>
TitleWindow.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml" title="Popup" width="300" height="300" closeButton="true" initialize="initKeyDown();">
<mx:Script>
private function initKeyDown():Void
{
var myListener:Object = new Object();
myListener. handleKeyDown);
Key.addListener(myListener);
}
private function handleKeyDown (event) : Void
{
if (Key.isDown(Key.ESCAPE))
{
this.deletePopUp();
Key.removeListener(handleKeyDown);
}
}
</mx:Script>
<mx:Label text="Hit the [ESCAPE] button to close."/>
</mx:TitleWindow>
Thanks,
Allen
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.269 / Virus Database: 267.9.2 - Release Date: 19/07/2005
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Computer software testing | Macromedia flex | Development |
| Software developer |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

