|
:: goes to look ::
Ah, 3rd parameter, useCapture:Boolean. From
the docs:
useCapture:Boolean (default =
false) Determines whether the listener will work in
the capture phase or the target and bubbling phases. If useCapture
is set to true, then the event listener will only process the event
during the capture phase, and not in the target or bubbling phases. If
false, then the event listener will only process the event during
the target or bubbling phases. To listen for the event in all three phases, call
addEventListener twice, once with useCapture set to
true, then again with useCapture set to false.
There was a bug in the alpha where if you didn't
have something solid (like Application.backgroundColor or something drawn on
_root), she didn't capture events period, even with useCapture).
Just something to try, not sure if it'll solve
it.
----- Original Message -----
Sent: Friday, February 10, 2006 2:27 PM
Subject: Re: [flexcoders] Flex 2 Beta - KeyboardEvent -
Problem
Hmm, yeah I was clicking on the movie, first.
What does
setCapture belong to?
Scott
On 2/10/06, JesterXL
< [EMAIL PROTECTED]>
wrote:
You still have to click on the flash movie itself
in the browser to give it focus (or modify the html-template to do a
flash.setFocus in the onload handler in _javascript_).
Additionally, have you tried screwing with the
3rd (or 4th?) parameter, setCapture?
----- Original Message -----
Sent: Friday, February 10, 2006 1:47 PM
Subject: Re: [flexcoders] Flex 2 Beta - KeyboardEvent -
Problem
Okay, spoke too soon.
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>
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 -----
Sent: Friday, February 10, 2006 12:27 PM
Subject: Fwd: [flexcoders] Flex 2 Beta - KeyboardEvent -
Problem
So, 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: [email protected]
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
I 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
YAHOO! GROUPS LINKS
--
: : ) 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
YAHOO! GROUPS LINKS
--
: : ) 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
YAHOO! GROUPS LINKS
--
: : )
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
YAHOO! GROUPS LINKS
|