[flexcoders] Re: KeyListener.onKeyDown = keyListenerFunction;

2006-02-22 Thread kjlinboomer
Thanks Matt,

I tried the following code which results in a syntax error:

var KeyListener:Object = new Object();
KeyListener.onKeyDown = mx.utils.Delegate(this, keyListenerFunction);
Key.addListener(KeyListener);

anything jump out at you?

Thanks,

Keith

--- In flexcoders@yahoogroups.com, Matt Chotin [EMAIL PROTECTED] wrote:

 You need to do KeyListener.onKeyDown = mx.utils.Delegate(this,
 keyListenerFunction);
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of kjlinboomer
 Sent: Tuesday, February 21, 2006 3:00 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] KeyListener.onKeyDown = keyListenerFunction;
 
 Hello,
 
 I have a key listener that instantiates itself in a contructor of a
 class.  When a key comes in, the key listener dispatches the call to a
 keyListenerFunction as in the subject of this post.
 
 The problem is that I am loosing focus to the rest of my class inside
 the handler function.  I want to be ablt to call a method in my class
 based on which key has been pressed:
 
 function keyListenerFunc() {
if (Key.getAscii() == 13) {
   Call some public function in my class here. 
   //saveFromAnnotationEdit();
}
if (Key.getAscii() == 97) {
   Call some public function in my class here.
 //addAnnotation();
}
   
 }
 
 Is there a way I can pass a reference into the handler function so I
 can access its methods?
 
 Thanks for any ideas,
 
 Keith
 
 
 
 
 
 --
 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/
 




RE: [flexcoders] Re: KeyListener.onKeyDown = keyListenerFunction;

2006-02-22 Thread Matt Chotin
Well I guess I did keyListenerFunction and you had keyListenerFunc?
What was the syntax error?

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kjlinboomer
Sent: Wednesday, February 22, 2006 6:42 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: KeyListener.onKeyDown = keyListenerFunction;

Thanks Matt,

I tried the following code which results in a syntax error:

var KeyListener:Object = new Object();
KeyListener.onKeyDown = mx.utils.Delegate(this, keyListenerFunction);
Key.addListener(KeyListener);

anything jump out at you?

Thanks,

Keith

--- In flexcoders@yahoogroups.com, Matt Chotin [EMAIL PROTECTED] wrote:

 You need to do KeyListener.onKeyDown = mx.utils.Delegate(this,
 keyListenerFunction);
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
 Behalf Of kjlinboomer
 Sent: Tuesday, February 21, 2006 3:00 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] KeyListener.onKeyDown = keyListenerFunction;
 
 Hello,
 
 I have a key listener that instantiates itself in a contructor of a
 class.  When a key comes in, the key listener dispatches the call to a
 keyListenerFunction as in the subject of this post.
 
 The problem is that I am loosing focus to the rest of my class inside
 the handler function.  I want to be ablt to call a method in my class
 based on which key has been pressed:
 
 function keyListenerFunc() {
if (Key.getAscii() == 13) {
   Call some public function in my class here. 
   //saveFromAnnotationEdit();
}
if (Key.getAscii() == 97) {
   Call some public function in my class here.
 //addAnnotation();
}
   
 }
 
 Is there a way I can pass a reference into the handler function so I
 can access its methods?
 
 Thanks for any ideas,
 
 Keith
 
 
 
 
 
 --
 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/