Hi guys,
I’ve been trying to add a preloader to my thumbnails, but it has been quite difficult (really considering the idea of buying an AS3 book).
Well, this is what I have
First the code to call the Thumbs from the XML file.
function callThumbs():void {
for (var i:Number = 0; i < my_total; i++) {
var thumb_url = my_videos*.@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+10)*x_counter;
thumb_loader.y = (my_thumb_height+10)*y_counter;
if (x_counter+1 < columns) {
x_counter++;
} else {
x_counter = 0;
y_counter++;
}
}
}
After this when the Thumb is loaded I have the thumbLoaded function to display it as follows:
function thumbLoaded(e:Event):void {
var my_thumb:Loader = Loader(e.target.loader);
container_mc.addChild(my_thumb);
my_tweens[Number(my_thumb.name)]=new Tween(my_thumb, “alpha”, Strong.easeIn, 0,1,0.5, true);
my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
}
What I really need to know is how to add a MovieClip to container_mc and when the Thumb is loaded, remove this MovieClip from it?