Specific yet simple problem: http://www.zone.ee/flashprojects/input.swf
What I want to achieve:
-
after 1st entering, NONE of present input fields[TF] is selected.
-
when i press TAB key[1st time], first TF is selected and cursor inside it is blinking.
-
pressing TAB key repeatedly, i can cycle through all TFs [one by one]. The RIGHT order of CYCLING through TFs is displayed inside TFs.
What i have so far:
-
TAB key press works ONLY AFTER i first click on any TF, TFs are cycled in BAD order. Cursor is blinking correctly.
-
implemented Key.DOWN listener. Works without need to first click on any TF, but cursor inside selected TF is missing which makes orientation difficult. TFs are cycled in the RIGHT order.
vital piece code:
function attachTextFields():Void{
for(var i=0; i<nTfCount-1; i++){ // "other" TFs
stg.createTextField("tf"+i, 3000+i, xpos, ypos, width, height);
stg["tf"+i].type = "input";
stg["tf"+i].text = i;
stg["tf"+i].onSetFocus = function(){
mcTfFocus._yscale = btnYScale;
}
} // "comment" TF:
stg.createTextField("tf"+(nTfCount-1), 3000+max_i+1, xpos, ypos, width, height);
stg["tf"+(nTfCount-1)].text = nTfCount-1;
stg["tf"+(nTfCount-1)].type = "input";
stg["tf"+(nTfCount-1)].multiline = true;
stg["tf"+(nTfCount-1)].wordWrap = true;
stg["tf"+(nTfCount-1)].onSetFocus = function(){
mcTfFocus._yscale = btnYScale*nTfCount;
}
Selection.setFocus("tf0");
};
// LISTENER: DOWN key
listen = new Object();
listen.onKeyDown = function(){
if(Key.getCode() == Key.DOWN) {
nFocused++;
nFocused = nFocused % nTfCount;
trace(nFocused);
Selection.setFocus("tf"+nFocused);
}
};
Key.addListener(listen);
Any help highly apprecciated.