Hi,
I’m doing a very simple slideshow, I was using loadmovie(), but trying to implement a preloader for each photo, I had to change to loadclip() to add the listener. Now I can’t resize, I don’t know how to do it.
I found the tutorial for the preloaders here, (http://www.kirupa.com/developer/acti...cliploader.htm) which is great, but if the pictures have different size, I don’t know how to resize them so they fit to the border.
I hope someone can help. Thanks!
Well, I wrote this and two minutes later I found the solution…
I’ll post it here in case that someone needs it as I needed before. But trust me, I spent a lot of time and nothing was working…
photo is a
photo = _root.createEmptyMovieClip("clip", 1);
photo.createEmptyMovieClip("holder",1);
photo.holder.loadMovie("URL of the photo");
// Taking initial position from the frame, +20 because it’s bigger than the picture.
photo._x = getProperty(frame,_x)+20;
photo._y = getProperty(frame,_y)+20;
photo.onEnterFrame = function() {
//make sure it has started loading
if (this.holder.getBytesLoaded()>4) {
if (this.holder.getBytesLoaded()<this.holder.getBytesTotal()) {
pos=Math.floor((this.holder.getBytesLoaded() / this.holder.getBytesTotal())*100);
// To manage the preloader, I put a dynamic Text box in which I write the percent
loading.text=pos + "%";
// and also a bar, with 100 frames, each frame bigger, as all preloaders hehe
bar2.gotoAndStop(pos);
} else {
// and now, when the image is loaded, we finally can resize it!
this._width = 150;
this._height = 150;
this.onEnterFrame = null;
// both dynamic text and bar2 dissappear
loading._visible=false;
bar2._visible=false;
}
}
};
This is just part of the slideshow I made, it takes the location of the photos from a XML file, if someone wants the source, I can post it.
Thanks and sorry for this stupid post