A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Add listener to keyboard question

  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    48

    Add listener to keyboard question

    Hi friends, I am kinda newbie with listeners and all that stuff, so I need your help with this.

    I have a form with 4 entries, and a button who sends that info to a php file who will display the stuff.

    I need to know how can I create a listeners that if some body press enter, the information is send as well. The form is buried 3 layers down from the root, same for the button. I know the next code is not correct, but just to give you and Idea of what I need

    PHP Code:
    keyListener = new Object();
    keyListener.onKeyUp = function ()
    {
       
    getURL("http://mysite.com/tracking.php""_blank""GET");
    input "";
    input2 "";
    input3 "";
    input4 "";
    }
    Key.addListener(keyListener); 
    Last edited by pucca017; 08-01-2008 at 11:23 AM.

  2. #2
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    PHP Code:
    keyListener = new Object();
    keyListener.onKeyDown = function (){
        if(
    Key.isDown(Key.ENTER)){
            
    getURL("http://mysite.com/tracking.php""_blank""GET");
            
    input "";
            
    input2 "";
            
    input3 "";
            
    input4 "";
        }
    }
    Key.addListener(keyListener); 
    If you don't think you're going to like the answer, then don't ask the question.

  3. #3
    Member
    Join Date
    Mar 2006
    Posts
    48
    THank you man! it worked perfect!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center