toddclare
08-26-2005, 08:47 PM
I'm running into a problem with what looks like Flash's inability to handle the number of component instances I have, and was wondering if anyone has any ideas?
I've got a swf that reads a list of (jpg) files from XML and creates a loder component or each of them. Once created, it calls load() on each:
for (var i:Number = 0; i < __paths.length; i++) {
//create a loader component
__topDepth = this.getNextHighestDepth();
createClassObject(Loader, "view"+ i, __topDepth);
this["view" + i].move(0,0);
this["view" + i].addEventListener("progress", this);
}
for (var i:Number = 0; i < __paths.length; i++) {
this["view" + i].load(__paths[i]);
}
Once all of them are done loading, I set them to a specific size and tell them to scaleContent, so that it'll display the whole image:
for (var i:Number = 0; i < __paths.length; i++) {
this["view" + i].scaleContent = true;
this["view" + i].setSize(__width, __height);
}
Problem is, when I run it, if I send it, say 24 image paths, all is well. If I send it 84, then about the last 1/2 do not seems to obey the setSize, and they don't seem to move to 0,0 either.
It seems odd to me that a generic code loop would generate different behavior on different loop intervals. Am I running into some limit of Flash for the number of components allowed or something?
Thanks, and I can provide files, swfs, etc. if needed.
-- TC
I've got a swf that reads a list of (jpg) files from XML and creates a loder component or each of them. Once created, it calls load() on each:
for (var i:Number = 0; i < __paths.length; i++) {
//create a loader component
__topDepth = this.getNextHighestDepth();
createClassObject(Loader, "view"+ i, __topDepth);
this["view" + i].move(0,0);
this["view" + i].addEventListener("progress", this);
}
for (var i:Number = 0; i < __paths.length; i++) {
this["view" + i].load(__paths[i]);
}
Once all of them are done loading, I set them to a specific size and tell them to scaleContent, so that it'll display the whole image:
for (var i:Number = 0; i < __paths.length; i++) {
this["view" + i].scaleContent = true;
this["view" + i].setSize(__width, __height);
}
Problem is, when I run it, if I send it, say 24 image paths, all is well. If I send it 84, then about the last 1/2 do not seems to obey the setSize, and they don't seem to move to 0,0 either.
It seems odd to me that a generic code loop would generate different behavior on different loop intervals. Am I running into some limit of Flash for the number of components allowed or something?
Thanks, and I can provide files, swfs, etc. if needed.
-- TC