ad0ac
April 5th, 2007, 08:20 PM
I've been experimenting with a simple imageViewer class, implemented like this:
var viewer1:thumbLoader = new thumbLoader(target_mc);
viewer1.loadImage("whatever.jpg");
my question is how would i use a for loop to make twenty viewers (1-20) load say, twenty elements from an array. One problem is that if I use a string like ["viewer" + i], the class file is expecting a movieclip and throws up a type mismatch. I would guess it's done something like this:
for (var i=0; i<20; i++) {
var this["viewer"+i]:Thumbloader = new thumbLoader("target_mc"+i);
}
but obviously this doesn't work. any help much appreciated.
var viewer1:thumbLoader = new thumbLoader(target_mc);
viewer1.loadImage("whatever.jpg");
my question is how would i use a for loop to make twenty viewers (1-20) load say, twenty elements from an array. One problem is that if I use a string like ["viewer" + i], the class file is expecting a movieclip and throws up a type mismatch. I would guess it's done something like this:
for (var i=0; i<20; i++) {
var this["viewer"+i]:Thumbloader = new thumbLoader("target_mc"+i);
}
but obviously this doesn't work. any help much appreciated.