Catching the ENTER key on a TextBox so that it can
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Macromedia Flash Server > Catching the ENTER key on a TextBox so that it can




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Catching the ENTER key on a TextBox so that it can  
RconR007


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-07-05 10: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






[ Post a follow-up to this message ]



    Re: Catching the ENTER key on a TextBox so that it can  
Millennium Multimedia


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-07-05 10: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






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:13 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register