NiNshiM
12-15-2009, 05:44 PM
Hello everyone,
I'm new in this forum as you can see (first post :D), and in need of help in a matter regarding imported components.
The problem is that I'm working in a flash website in AS3 (recently migrated from AS2), and I'm having trouble with the Text Input component. I just want to import a Text Imput component into a movieclip located in the Main timeline, and then store it in an Object Variable or push it to an Array.
To do something like this in AS2, with a movieclip in the library I would do:
attachMovie("img", "img"+i, this.getNextHighestDepth());
myArray.push(_root["img"+i]);
But, can I apply this same principle in AS3 when importing a component instance? I tried it like this:
counter++; //A number variable that will count the instances of the component in the stage
var imgTxt:TextInput = new TextInput();
form1.addChild(imgTxt); //form1 is my movieclip in the main timeline
imgTxt.name = "imgTxt"+counter;
myArray.push(form1.imgTxt.name); /*Now, my problem lies here because this line returns me an error. Is there some easy way to do what
I'm trying to do here? I also tried myArray.push(form1[imgTxt.name]), wich lead to an error either*/
I'm new in this forum as you can see (first post :D), and in need of help in a matter regarding imported components.
The problem is that I'm working in a flash website in AS3 (recently migrated from AS2), and I'm having trouble with the Text Input component. I just want to import a Text Imput component into a movieclip located in the Main timeline, and then store it in an Object Variable or push it to an Array.
To do something like this in AS2, with a movieclip in the library I would do:
attachMovie("img", "img"+i, this.getNextHighestDepth());
myArray.push(_root["img"+i]);
But, can I apply this same principle in AS3 when importing a component instance? I tried it like this:
counter++; //A number variable that will count the instances of the component in the stage
var imgTxt:TextInput = new TextInput();
form1.addChild(imgTxt); //form1 is my movieclip in the main timeline
imgTxt.name = "imgTxt"+counter;
myArray.push(form1.imgTxt.name); /*Now, my problem lies here because this line returns me an error. Is there some easy way to do what
I'm trying to do here? I also tried myArray.push(form1[imgTxt.name]), wich lead to an error either*/