A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with text input fields and 'Enter' key

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Posts
    8

    Help with text input fields and 'Enter' key

    Hi guys,

    I'm pretty new to AS 3. I've been tasked with converting an online calculator from AS2 to AS3 and am having trouble figuring out how to get one of the functions to work.

    There are several input fields, restricted to numbers, which are ordered by tabIndex. When you enter a value and hit the 'Enter' key, it deletes the numbers the user just typed and focuses in on the now blank text field.

    What I need it to do is focus on the text field, and instead of deleting the text, select it.

    Any help would be greatly appreciated.

    I've included part of my code so far, if it helps.

    Code:
    txt1.tabIndex = 1;
    txt2.tabIndex = 2;
    txt3.tabIndex = 3;
    txt4.tabIndex = 4;
    txt5.tabIndex = 5;
    txt6.tabIndex = 6;
    
    txt1.restrict = "0123456789";
    txt2.restrict = "0123456789.";
    txt3.restrict = "0123456789.";
    txt4.restrict = "0123456789.";
    txt5.restrict = "0123456789";
    txt6.restrict = "0123456789";

  2. #2
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    my first guess would be that you are not deleting the numbers, instead you are adding a new line to the text field.

    to find out if you are simply adding a new line (which would push the number up and you won't see them anymore), click and drag in the textfield like you are selecting text. make sure you move the mouse up and see if the textfield scrolls up to reveal the missing text.

    if that is the case, you are going to have to learn a bit about events and how they bubble and how you can prevent them/capture them in the way that you want.

    http://help.adobe.com/en_US/FlashPla...nts/Event.html

    information about events. look at the 'Other sources of information include:' just before the first property
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  3. #3
    Junior Member
    Join Date
    Jan 2008
    Posts
    8
    Wow...now I feel really dumb for not checking for the multi-line issue...Thanks so much, that was the biggest issue I was facing!

    It's always the little things....

    Quote Originally Posted by Baby Minion View Post
    my first guess would be that you are not deleting the numbers, instead you are adding a new line to the text field.

    to find out if you are simply adding a new line (which would push the number up and you won't see them anymore), click and drag in the textfield like you are selecting text. make sure you move the mouse up and see if the textfield scrolls up to reveal the missing text.

    if that is the case, you are going to have to learn a bit about events and how they bubble and how you can prevent them/capture them in the way that you want.

    http://help.adobe.com/en_US/FlashPla...nts/Event.html

    information about events. look at the 'Other sources of information include:' just before the first property

Tags for this Thread

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