Copy link to clipboard
Copied
Hi,
I've created a movieclip instance named grid1 and is accessing various child objects (textInputs) inside that movie clip using - grid1.getChildAt(1).scaleX=10; (eg).
However, what's wrong with the below lines?
grid1.getChildAt(1).textField.backgroundColor=0xffcc00;
Error 1119: Access of possibly undefined property textField through a reference with static type : flash.display:DisplayObject;
or
grid1.getChildAt(1).setSize(500,500);
Error:1061: Call to a possibly undefined method setSize through a reference with static type: flash.display:DisplayObject;
when textInput 'text1' is on stage, following codes are working fine:
text1.textField.backgroundColor = 0xffcc00;
text1.setSize(120,50);
if you have a correct reference, cast that object as a TextInput. but, in general, that's poor coding.
assign your textinput an instance name (eg, ti) and use that in your reference:
var ti:TextInput=TextInput(grid1.getChildByName("ti"));
ti.background=true;
ti.etc..
Copy link to clipboard
Copied
if you have a correct reference, cast that object as a TextInput. but, in general, that's poor coding.
assign your textinput an instance name (eg, ti) and use that in your reference:
var ti:TextInput=TextInput(grid1.getChildByName("ti"));
ti.background=true;
ti.etc..
Copy link to clipboard
Copied
thank a tonne for the guidance... following worked for me-
var ti:TextInput=TextInput(grid1.getChildByName("text1"));
ti.textField.background=true;
ti.textField.backgroundColor=0xffcc00;
//where text1 is my TextInput reference inside MovieClip grid1
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now