View Full Version : Generating textfields in a for-loop, not working.
joakimlinden
November 21st, 2005, 02:13 PM
Why doesn't this work?
times = 6;
for (i = 0; i <= times; i++) {
_root.createTextField("txt" + i, _root.getNextHighestDepth());
_root["txt" + i].text = i;
trace(_root["txt" + i]);
}
It works for empty and library-linked mc's but not textfields...
stringy
November 21st, 2005, 02:18 PM
Why doesn't this work?
times = 6;
for (i = 0; i <= times; i++) {
_root.createTextField("txt" + i, _root.getNextHighestDepth());
_root["txt" + i].text = i;
trace(_root["txt" + i]);
}
It works for empty and library-linked mc's but not textfields...
times = 6;
you need more parameters eg/
for (i = 0; i <= times; i++) {
_root.createTextField("txt"+i,i,200,50*i,50,20)
_root["txt" + i].text = i;
trace(_root["txt" + i]);
}
joakimlinden
November 21st, 2005, 03:33 PM
oh, so it has to recieve x,y,width,height to even become an instance? I didn't know that... I'll try in few minutes, thanks!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.