Its still a problem Matt.
My code is exactly the same as the example, but i'll paste here 
anyway.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
initialize="initApp()">
    <mx:Script>
    <![CDATA[
    
                private function initApp():void 
                {
            application.addEventListener(KeyboardEvent.KEY_UP, 
keyHandler);
        }

        //This function quits the application if the user presses 
SHIFT+Q.
        private function keyHandler(event:KeyboardEvent):void 
        {
 trace("worked");
            var bControlPressed:Boolean = event.shiftKey;
            if (bControlPressed) 
            {
                var curKeyCode:int = event.keyCode;
                if (curKeyCode == 81) 
                { 
                        // 81 is the keycode value for the Q key
                    // Quit the application by closing the browser 
using JavaScript.
                    var url:URLRequest = new URLRequest
("javascript:window.close()");
                    navigateToURL(url,"_self");
                }
            }
        }
        
    ]]>
    </mx:Script>
</mx:Application>

i run this example from flexbuilder2beta2. i do focus on the html 
page (that flexbuilder creates) using my mouse.
any more ideas thanks.

regards
bod



--- In [email protected], "Matt Horn" <[EMAIL PROTECTED]> wrote:
>
> A couple of things to note:
>  - The example comments say to use Ctrl+Q, but the implementation 
is
> looking for Shift+Q, so make sure you're pressing shift+q.
>  - The app must have focus inside the browser for it to start 
capturing
> keys. I added a button and clicked the button first, to make sure 
my app
> had focus.
>  - You need to run the app with a wrapper -- I don't know if it 
will
> work if you request the SWF file directly. Easiest thing to do is
> request it's MXML file from the Flex web application
> - With these things in mind, I just tried it on FDS beta 2 and it 
worked
> for me.
> 
> LMK if you're still having trouble.
> 
> matt
> 
> -----Original Message-----
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of bhaq1972
> Sent: Wednesday, April 12, 2006 10:28 AM
> To: [email protected]
> Subject: [flexcoders] Re: Flex2B2 - Handling keyboard events
> 
> Hi Matt
> I should have been a bit more specific with whats wrong. I'm 
> actually not event triggering the event. i've got a trace() on the 
> first line of the keyHandler() function.
> 
> btw i'm using windows xp/ IE browser
> 
> --- In [email protected], "Matt Horn" <mhorn@> wrote:
> >
> > The javascript:window.close() technique only works in some 
> browsers. The
> > example is only meant to show using keyboard events, and not 
> provide a
> > foolproof way to close all browsers.
> > 
> > I'll make a note of that in the example.
> > 
> > Matthew J. Horn
> > Flex docs
> > 
> > -----Original Message-----
> > From: [email protected] 
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of bhaq1972
> > Sent: Wednesday, April 12, 2006 7:47 AM
> > To: [email protected]
> > Subject: [flexcoders] Flex2B2 - Handling keyboard events
> > 
> > The following example from the help doesn't work. how do i make 
it 
> > work? thanks
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
> > initialize="initApp()">
> >     <mx:Script><![CDATA[
> >         private function initApp():void {
> >             application.addEventListener
> > (KeyboardEvent.KEY_UP,keyHandler);
> >         }
> > 
> >         //This function quits the application if the user 
presses 
> > CTRL+Q.
> >         private function keyHandler(event:KeyboardEvent):void {
> >             var bControlPressed:Boolean = event.shiftKey;
> >             if (bControlPressed) {
> >                 var curKeyCode:int = event.keyCode;
> >                 if (curKeyCode == 81) { // 81 is the keycode 
value 
> > for the Q key
> >                     // Quit the application by closing the 
browser 
> > using JavaScript.
> >                     var url:URLRequest = new
> >                         URLRequest("javascript:window.close()");
> >                     navigateToURL(url,"_self");                
> >                 }
> >             }
> >         }
> >     ]]></mx:Script>
> > </mx:Application>
> > 
> > (btw one typo in the example...needed to remove the 'public' 
from 
> > the local variable)
> > 
> > 
> > 
> > 
> > 
> > --
> > 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
> >
> 
> 
> 
> 
> 
> 
> --
> 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
>






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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to