dcsimg
A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: Urgent help TAB needed !!!!

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340

    Urgent help TAB needed !!!!

    Help...! I need my ENTER key to act exactly the same as my TAB key....

    Does anyone have a quick script for this that I can use...


    THANKS....

    D..............

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340
    Heyyyy...all you smart Flash developers out there........


    Don't all answer at once..........!!!!!!!!!!!!!!!!!!

  3. #3
    Japanese l337 TRJNET's Avatar
    Join Date
    Mar 2001
    Location
    Toronto, Canada
    Posts
    399
    lol, i dunno man, is that even possible to do that via ActionScripting ??
    consultant / contractor / designer

  4. #4
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340
    aaaAAAAAAAAAAAAANNNNNNNNYYYYYYYYYYOOOONEEEEEEEEEEE EEEEE..!!!


    i KNOW u KNOW............!!!!!!

  5. #5
    maybe more info will help your cause. what is the enter key doing at the moment? the tab key? what code do you already have? what do you want the code to do?

  6. #6
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    You mean act as the tab key in the way the tab key changes the selection of the current field/mc/button/etc?

  7. #7
    Senior Member
    Join Date
    Aug 2003
    Posts
    163
    Do u want to know how to tell if the enter key is pressed? That's:

    if(Key.isDown(Key.ENTER)){
    //put code here
    }

  8. #8
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340
    I have a form with many fields, which tab in order....no problem there.....My audio file which cannot be changed, says to use the TAB or ENTER keys to tab the fields...


    I have an OK button which validates the fields....the ENTER button is doing NOTHING...........

    I want it to tab the fields in the EXACT same way the TAB key does...even if I make them both the same button

    .tabindex = .enter

    or something like that.......!!!

    Helllpppppppppp.......


    THNX.........!

  9. #9
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340
    Anyone have a solution for this..........!!!!!!!!!!!!!!!!!!!!!!!!!!!

  10. #10
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    You need to create a listener (read it up in Flash help - they have a couple of examples and it is quite straightforward).
    For example:
    PHP Code:
    someListener = new Object();
    someListener.onKeyDown = function() {
        if (
    Key.isDown(Key.ENTER)) {
            
    // Whatever code you need
        
    }
    };
    Key.addListener(someListener); 

  11. #11
    Junior Member
    Join Date
    Jul 2003
    Posts
    19
    give me the audio and ill edit out the enter bit. problem solved.

    Other solution. replace your enter key with your tab key. PEOPLE CHANGE EVERY SINGLE KEY ON THE KEYBOARDS AT OUR SCHOOL. kids who cannot touch type go nuts trying to fix it. lol.

  12. #12
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    All very well avoiding the problem, but it is hardly necessary. Selection.setFocus combined with a listener will do everything you need.

  13. #13
    Junior Member
    Join Date
    Jul 2003
    Posts
    19
    Not only would it be easier, but wouldn't it save precious space???? lol, im just joking around i don't really mind.

  14. #14
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Don't mind me, I'm a grumpy old git anyway.

    I just don't want people going away there is no solution when there is one ...

  15. #15
    Junior Member
    Join Date
    Jul 2003
    Posts
    19
    Originally posted by AlsoGaiusCoffey
    Don't mind me, I'm a grumpy old git anyway.

    I just don't want people going away there is no solution when there is one ...
    YOu should find the best solution. You can't be like a store that talks people into buying the crappy product that isn't right for the customer because its the only one in stock. the best solution for this situation doesn't involve ac... anyway im rambling and i don't give a sh** anyway. lol.

  16. #16
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340
    Thanks for the replies...

    I have put in this code...

    someListener = new Object();
    someListener.onKeyDown = function() {
    if (Key.isDown(Key.ENTER)) {
    name1TF.Selection.setFocus = 1;
    name2TF.Selection.setFocus = 2;
    name3TF.Selection.setFocus = 3;
    name4TF.Selection.setFocus = 4;
    name5TF.Selection.setFocus = 5;
    }
    };
    Key.addListener(someListener);

    and still my fields aren't tabbing when I hit the ENTER key...!

    what am I doing wrong...???

  17. #17
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Er ... you need to have a bit of code to select where you are and where you go to. What you have there selects five textfields in order, the same order each time, and leaves you always in the last field.

    One way to do this is as follows:
    1. Make an array of the textfields in the same order as your tabbing. eg:
    PHP Code:
    TF_arr = [tf1,tf2,tf3,tf4.tf5]; 
    2. On keyPressEnter, search through the array to find the current TF then go to the next one, eg:
    PHP Code:
    var currentfield Selection.getFocus();
    var 
    nextField 0;
    for (var 
    i=0;i<TF_arr.length;i++){
    if(
    currentfield == targetpath(TF_arr[i])){
    nextField i+1;
    }
    }
    // Loop if nextField is bigger than TF_arr.length
    nextField %= TF_arr.length
    Selection
    .setFocus(targetpath(TF_arr[nextField])); 
    So you end up with:
    PHP Code:
    TF_arr = [name1TF,name2TF,name3TF,name4TF,name5TF]
    someListener = new Object();
    someListener.onKeyDown = function() {
    if (
    Key.isDown(Key.ENTER)) {
    var 
    currentfield Selection.getFocus();
    var 
    nextField 0;
    for (var 
    i=0;i<TF_arr.length;i++){
    if(
    currentfield == targetpath(TF_arr[i])){
    nextField i+1;
    }
    }
    // Loop if nextField is bigger than TF_arr.length
    nextField %= TF_arr.length
    Selection
    .setFocus(targetpath(TF_arr[nextField]));
    }
    };
    Key.addListener(someListener); 

  18. #18
    Senior Member
    Join Date
    Apr 2003
    Location
    Ottawa, Canada
    Posts
    340
    i'll try it out......


    thanks for your help.......

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