1

I"m having an issue at the moment trying to tab through textfields within movieclips (called through a for loop). It no matter which one is selected, hitting tab will always select the first textfield created and won't move from there. Not even using tabbing index works

Here's the code within the movieclip (the textfields are physical objects)

import flash.text.TextField;
import flash.events.FocusEvent;
import fl.managers.FocusManager;
import flash.events.Event;

var str:String = "Default";

textf.text = str;
textf.textColor = 0x848484;
hlborder.visible = false;

var focusManager:FocusManager = new FocusManager(this);

textf.addEventListener(FocusEvent.FOCUS_IN, tffin);
textf.addEventListener(FocusEvent.FOCUS_OUT, tffout);

function tffin(e:Event):void{
    textf.borderColor = 0x0066FF;
    hlborder.visible = true;
    if(textf.text == str){
        textf.text = "";
    }
}

function tffout(e:Event):void{
    textf.borderColor = 0x000000;
    hlborder.visible = false;
    if(textf.text == ""){
        textf.text = str;
    }
}

Here's where they are added to the main timeline

var carr:Array = new Array();
for(var i = 0; i<10; i++){
    carr.push(new custField());
    carr[i].y = i*30;
    carr[i].x = 30;
    addChild(carr[i]);
    carr[i].textf.tabIndex = i;
}
James McGrath
  • 187
  • 1
  • 4
  • 15

2 Answers2

0

Have you tried putting each TextField in a seperate movieclip? I think that should most likely fix the problem.

MNOPYZ
  • 55
  • 1
  • 2
  • 13
  • 1
    I'm trying to work on a modular approach with this application. So technically they are separate movieclips as they each have a separate instance, but they are all instances off the same object in the library, referenced through an array. – James McGrath Jul 17 '14 at 11:48
0

Same issue. I have MovieClips with 3 TextFields and single TextFields. Helped this:

  1. Remove all tabIndex
  2. Set on MovieClips tabChildren = true

Now tab goes from left to right and from top to bottom even throw child TextFields.

Sergey Senkov
  • 1,490
  • 1
  • 13
  • 23