I’m loading a bunch of thumbnail images into a grid. I can get them to load fine but I need to turn the smoothing on on them and when I do this only one image seems to appear. Here is the code:
//here’s where the images are called:
function callThumbs():void {
for (var i:Number = 0; i < my_total; i++) {
var thumb_url = my_images*.@THUMB;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.name = i;
thumb_loader.x = (my_thumb_width)*x_counter;
thumb_loader.y = (my_thumb_height)*y_counter;
if (x_counter+1 < columns) {
x_counter++;
} else {
x_counter = 0;
y_counter++;
}
}
}
Here’s what happens after the thumbs are loaded. If i just place the loader all of the images show up but when I try and turn the loader into a bitmap and smooth it then only one image is appearing
function thumbLoaded(e:Event):void {
var my_thumb:Loader = Loader(e.target.loader);
var bitMap:Bitmap = Bitmap(my_thumb.content);//get the loaders content as a bitmap
bitMap.smoothing = true;//turn on smoothing
bitMap.width = 166;
bitMap.height = 249;
var temp:MovieClip = new MovieClip();
temp.addChild(bitMap);
container_mc.addChild(temp);
//THE CODE BELOW COMMENTED OUT WORKS BUT NOT THE STUFF ABOVE
//my_thumb.width = 166;
//my_thumb.height = 249;
//container_mc.addChild(my_thumb);
my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
}