A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Focusing on the next object

  1. #1
    hmm Pugger's Avatar
    Join Date
    Sep 2003
    Location
    Perth, Australia
    Posts
    616

    Focusing on the next object

    You know when you press tab on a form, you can pass focus from one object to the next.

    I want to get the next object to receive focus, but have yet to find a method or variable that can help me. I feel the answer is within the focusManager class.

    Any clues?

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    if they're all children, you can use depth and array access

    e.g.,
    Code:
    function maketf(a,b){var c=a.getNextHighestDepth();a.createTextField(c,c,0,0,0,0);for(var i in b)a[c][i]=b[i];return a[c];}
    function jumpto(){if(Key.isDown(Key.TAB)){var a=Math.max(0,Math.min(this._parent.getNextHighestDepth(),this.getDepth()+1));Selection.setFocus(this._parent[a]);}}
    var parentclip = this.createEmptyMovieClip(0,0);
    for(var i=10;i--;)Key.addListener(maketf(parentclip, {autoSize:true, _x:20, _y:20*i, type:'input', onKeyDown:jumpto, text:'im textbox number '+i}));

  3. #3
    hmm Pugger's Avatar
    Join Date
    Sep 2003
    Location
    Perth, Australia
    Posts
    616
    Thanks,

    But I don't know if that is quite what I am after. This is for a V2 component, so I want to be able to use the focusManager to manage things.

    I have a component with a textField within it. I can focus on the textField, but if I do that you get trapped within the component and pressing tab wont let you out. Macromedia have seemed to have solved this with their own components like the inputfield. Am I able to look at the source code of these (for MAC OSX) or does anyone know how they did the focus for these components?
    Last edited by Pugger; 10-10-2005 at 11:00 PM.

  4. #4
    hmm Pugger's Avatar
    Join Date
    Sep 2003
    Location
    Perth, Australia
    Posts
    616
    Don't worry, I fixed the problem by checking out the label components source code.

    Cya

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