Apparently it isn't working the way I did it.
It actually seems to be breaking worse now, with no event firing! I placed that line in my init(), which fires onCompletion:
<?xml version=" 1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.macromedia.com/2005/mxml "
xmlns="*"
layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
import com.imagetrend.containers
.debug.*;
import mx.core.Application ;
import flash.events.KeyboardEvent;
import mx.controls.Alert;
private function init() {
stage.focus = this;
this.addEventListener(KeyboardEvent.KEY_DOWN, trapKeys);
}
private function trapKeys(e:KeyboardEvent) {
textArea.text = String(e.charCode) + "/" + String(e.keyCode);
Debugger.show();
Alert.show("trapKeys()");
}
]]>
</mx:Script>
<mx:Canvas id="mainCanvas" width="100%" height="100%">
<mx:TextArea id="textArea" width="236" height="196">
</mx:TextArea>
</mx:Canvas>
</mx:Application>
import mx.core.Application ;
import flash.events.KeyboardEvent;
import mx.controls.Alert;
private function init() {
stage.focus = this;
this.addEventListener(KeyboardEvent.KEY_DOWN, trapKeys);
}
private function trapKeys(e:KeyboardEvent) {
textArea.text = String(e.charCode) + "/" + String(e.keyCode);
Debugger.show();
Alert.show("trapKeys()");
}
]]>
</mx:Script>
<mx:Canvas id="mainCanvas" width="100%" height="100%">
<mx:TextArea id="textArea" width="236" height="196">
</mx:TextArea>
</mx:Canvas>
</mx:Application>
On 2/10/06, Scott Langeberg
<[EMAIL PROTECTED]> wrote:
Strange, but makes sense!
Jester, how come you're always the one that figures out my problems? Isn't the Macromedia/Adobe staff on this list?
;) Take care,
Scott--On 2/10/06, JesterXL <[EMAIL PROTECTED]> wrote:It's easy to fix; do:stage.focus = this;In your creationComplete event.----- Original Message -----From: Scott LangebergSent: Friday, February 10, 2006 12:27 PMSubject: Fwd: [flexcoders] Flex 2 Beta - KeyboardEvent - ProblemSo, can we safely call it a bug: Flex doesn't pick up keyboard events - unless there's component focus?
Thanks,
Scott
---------- Forwarded message ----------
From: Matt Horn <[EMAIL PROTECTED]>
Date: Feb 9, 2006 10:20 AM
Subject: RE: [flexcoders] Flex 2 Beta - KeyboardEvent - Problem
To: flexcoders@yahoogroups.com
it seems to be something with having focus. when you first start the app, there's no focus on any control inside the app. I added a Button and click the Button. after that it works fine... so it doesn't appear to require that you click on the TextArea, just that you provide focus to something in the app... maybe someone else can chime in with a reason why or a workaround.matt h
From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Scott Langeberg
Sent: Thursday, February 09, 2006 10:54 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 2 Beta - KeyboardEvent - ProblemI can't get the following keyboardevent to fire, unless you click into the textarea on the stage. Any ideas why that would be?--
Note: I've tried adding the listener to: application, Application.application, the canvas on the stage, etc...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.macromedia.com/2005/mxml"
xmlns="*"
layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
import com.imagetrend.containers.debug.*;
import mx.core.Application ;
import flash.events.KeyboardEvent;
import mx.controls.Alert;
private function init() {
this.addEventListener(KeyboardEvent.KEY_DOWN, trapKeys);
}
private function trapKeys(e:KeyboardEvent) {
textArea.text = String(e.charCode) + "/" + String(e.keyCode);
Debugger.show();
Alert.show("trapKeys()");
}
]]>
</mx:Script>
<mx:Canvas id="mainCanvas" width="100%" height="100%">
<mx:TextArea id="textArea" width="236" height="196">
</mx:TextArea>
</mx:Canvas>
</mx:Application>
--
: : ) Scott
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
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 .
--
: : ) Scott
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
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 .
: : ) Scott
--
: : ) Scott
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
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.