|
Home > Archive > Macromedia Flash Server > April 2005 > Catching the ENTER key on a TextBox so that it can
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Catching the ENTER key on a TextBox so that it can
|
|
| RconR007 2005-04-07, 5:51 pm |
| Hi List:
I am trying to catch the ENTER key from a textbox so that I can run a
function to update the chat list.
Basically the user doesn't want to hit the SEND button on the chat,
they want to hit the ENTER key.
I typed the following code on the onSetFocus of the textbox:
message.onSetFocus = function() {
myReturnKey = new Object();
myReturnKey.onKeyDown = function(){
var _$key = key.getCode();
if(_$key == 13){
// Perform my function to update the chat history... The
chat history function then clears the textbox, but I still get a
RETURN or Carriage Return // that shouldn't happen if I
am making my textbox = ""; HELP
}
}
key.addListener(myReturnKey);
}
But its producing a weird result. I am getting a RETURN that is
inserted into the textbox once I update the chat.
Any suggestions, because this is driving me crazy.
Thank you,
--
Life is short, maximize your time,
RconR-007
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Millennium Multimedia 2005-04-07, 5:51 pm |
| Not sure if this will help in any way, but this is the code I use to
submit via enter key (AS1):
//detect enter button press
enterListener = new Object();
enterListener.onKeyDown = function() {
if (Key.isDown(Key.ENTER)) {
trace(Selection.getFocus());
//function here
}
};
Key.addListener(enterListener);
// Lisa Larson
On Mar 1, 2005, at 6:09 PM, RconR007 wrote:
> Hi List:
>
> I am trying to catch the ENTER key from a textbox so that I can run a
> function to update the chat list.
> Basically the user doesn't want to hit the SEND button on the chat,
> they want to hit the ENTER key.
> I typed the following code on the onSetFocus of the textbox:
>
> message.onSetFocus = function() {
> myReturnKey = new Object();
> myReturnKey.onKeyDown = function(){
> var _$key = key.getCode();
> if(_$key == 13){
> // Perform my function to update the chat history... The
> chat history function then clears the textbox, but I still get a
> RETURN or Carriage Return // that shouldn't happen if I
> am making my textbox = ""; HELP
> }
> }
> key.addListener(myReturnKey);
> }
>
>
> But its producing a weird result. I am getting a RETURN that is
> inserted into the textbox once I update the chat.
> Any suggestions, because this is driving me crazy.
>
> Thank you,
> --
> Life is short, maximize your time,
>
> RconR-007
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|
|
|
|
|