Answered
set focus on incrementally named text fields
I am creating many (several hundred) text fields via
actionscript. I incrementally name them and place them on the stage
and then access them later on to set focus.
I utilize create a textfield object:
var txtbox:TextField = new TextField();
and then use an incremented name to the text field to identify it later on:
var txtname:String = txtn+txtcnt; // txtcnt is an incremented number variable. txtn is a string variable.
txtbox.name = txtname;
I add an eventlistener to the stage. The event listener works fine, and has a companion function.
I can identify the text field I want to access once the moving is running via its name.
Then I use that .name property to attempt to set focus:
stage.focus = "txt88";
Again, "txt88" is the .name of the text field.
What am I doing wrong?
ypeError: Error #1034: Type Coercion failed: cannot convert "txt88" to flash.display.InteractiveObject.
at MethodInfo-200()
Also, i have tried to use the incremented variable in this step, but get an error msg assigning the textfield variable name this way.
var txtname:TextField = new TextField();
I utilize create a textfield object:
var txtbox:TextField = new TextField();
and then use an incremented name to the text field to identify it later on:
var txtname:String = txtn+txtcnt; // txtcnt is an incremented number variable. txtn is a string variable.
txtbox.name = txtname;
I add an eventlistener to the stage. The event listener works fine, and has a companion function.
I can identify the text field I want to access once the moving is running via its name.
Then I use that .name property to attempt to set focus:
stage.focus = "txt88";
Again, "txt88" is the .name of the text field.
What am I doing wrong?
ypeError: Error #1034: Type Coercion failed: cannot convert "txt88" to flash.display.InteractiveObject.
at MethodInfo-200()
Also, i have tried to use the incremented variable in this step, but get an error msg assigning the textfield variable name this way.
var txtname:TextField = new TextField();
