A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Getting Focus problem

  1. #1
    Junior Member
    Join Date
    Oct 2000
    Posts
    20

    Getting Focus problem

    Hi there,

    I have a quiz which I need to make an attempt to get Accessible. I've got the Yes and No Buttons tabbing between each other, but I am totally getting wrapped around trying to get which one is currently selected.

    I've tried

    Btn_Yes.onSetFocus = function() {
    _root.txt_display="Yes button has focus";
    _root.ChosenButton = "Yes";
    };

    But it ain't working.....

    please help the little people

    www.burtware.com

  2. #2
    Member
    Join Date
    Sep 2001
    Location
    Málaga, Spain
    Posts
    98
    hi, the code seems correct to me. but you have to set a tab index for your buttons to have the onSetFocus function work:

    Btn_Yes.tabEnabled=true
    Btn_No.tabEnabled=true
    Btn_Yes.tabIndex=0
    Btn_No.tabIndex=1

    so the onSetFocus will happen when the button receives keyboard focus.

    hope this helps

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Posts
    20
    I had already put these lines in at the very start.

    _global.tabEnabled = "true";
    _global._focusrect = "true";

    bt_Yes.tabindex = 1;
    bt_No.tabindex = 2;

    It show the focus when I run it and tab between them, But I can't find a way of setting a variable dependant on which has the focus.

    So that when you tab between it will set var_answer to the appropriate state. Then detect a spacebar key press and move to the next question.

    Seemed a simple idea when I started....

    www.burtware.com

  4. #4
    Member
    Join Date
    Sep 2001
    Location
    Málaga, Spain
    Posts
    98
    hi,
    i have made a file for you and i uploaded on my url. then just click on number 10.
    a couple of notes: in the code you posted you forget capital letters (tabindex instead of tabIndex and use different names for your buttons: bt_Yes and btn_Yes, for example. i don't know if it is the same in your .fla but just in case, i mention it to you.
    http://www.avidasense.com/eng/myavida.htm

    i hope this file solves your problem. let me know if it doesn't.

  5. #5
    Junior Member
    Join Date
    Oct 2000
    Posts
    20

    space bar isn't moving frame

    Hi there,

    Sorry for delay - bit of a cold.

    Tried the fla file, but it doesn't move forward when you press the spacebar. It tabs correctly but no movement ?
    www.burtware.com

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