createTextField [help]
- Started
- Last post
- 12 Responses
- goygoygoy
hi,
I'm trying to duplicate a mc that createTextField... without any succes.
dOES anyone want to see whats wrong with my .fla or code below ?
thks, cheersfor (i=1; i<=5; ++i) {
iteration = new Array();
container.duplicateMovieClip("n... i);
iteration[i] = ["n"+i];
container.textfield.text = i;
["n"+i]._y = 30*i;
}
- frankbb0
this should work...
for (i=1; i<=5; ++i) {
this.createEmptyMovieClip("mc"+i... i);
this["mc"+i].createTextField("tx... i+100, 0, 0, 300, 100);
myformat.color = 0xff0000;
this["mc"+i].txt.text = "humm";
txt.setTextFormat(myformat);
this["mc"+i]._y = 30*i;
}
- ruf0
you should put eval ("n"+i) so that the array records the mc and not just the variable name.
I havn't tested your code or looked at the response properly but you should defo use eval otherwise you are just recording a string and not the clip itself.
Ruf
- goygoygoy0
it does, thanks man
- frankbb0
There is no need too.. I have seen this alot where people stick everything in arrays..
Why?
You can still access it easily, in fact just the same way. What is the point..??
it is still a string in the array..
- ruf0
yeah but then you don't have to constantly convert your variable to a mc everytime you refer to it...
Arrays are easily the best way of keeping track of all your mc's if you are dynamically creating them. Otherwise you end up with really messy code.
Array = Good
Ruf
- ruf0
Just an opinion man... I ain't no rocket scientist.
Ruf
- ruf0
flogging dea horse but... I would have done it:
for (i=1; i<=5; ++i) {
var newName = "mc" add i;
this.createEmptyMovieCli
p("mc"+i, i);
var newClip = eval(newName);
newClip.createTextF
ield("txt", i+100, 0, 0, 300, 100);
myformat.color = 0xff0000;
newClip.txt.text = "humm";
tnewClip.txt.setTextFormat(myfor...
at);
newClip._y = 30*i;
myArray.push(newClip);
}But that's just Potato Potato...
Ruf
')
- frankbb0
i ain't either, but if i am missing something out I want to know why..
i get that if you use arrays you can do this
lev=new Array()
lev= eval('mc'+i)and then use lev to get at it
instead ofthis['mc'+i]
i am just tring to find out the best way to use flash..
- ruf0
damn... I made a mistake... Oh well.... I need to shut up!
Ruf
- frankbb0
i get where you are coming from..
- ruf0
ok... so if you have made an Array what you can do is:
positional
Y = myArray[3]._y;variable
myArray[3].vOn = true;search
if (myArray[3].vOn){
do good stuff;
}etc...
you can also move multiple objects at once using for loops and you can change multiples at once using the same.
You could also mak sure you are using var for variables that you only use once and this saves on memroy usage.
If you want a better explaination or an example drop me a mail and I'll try and lend a hand.
Ruf
- ruf0
nice site btw... I like the illustration.
Ruf