Hello,
I’m building a picture slideshow and want to place my pictures (loaded jpegs) next to each other.
Simple, but the only problem is they all differ in width.
So I came up with a ‘main’ movieclip wich holds 10 other ‘containerMC’ movieclips in wich the pics get loaded.
Basically looks like this : http://theremedy.be/scrap/spaz03.htm (click the squares, wait till loading is complete)
Now my question. Could you please be so kind to help me clean up this code.
There’s gotta be a cleaner way to script this. If you wish I will reward you with the final working fla.
I use this :
MovieClip.prototype.loadPic = function(pic) {
this.loadMovie(pic);
_root.onEnterFrame = function() {
for (i=0; i<10; i++) {
var t = _root.main["containerMC"+i].getBytesTotal(), l = _root.main["containerMC"+i].getBytesLoaded();
if (t != 0 && Math.round(l/t) == 1) {
_root.main["containerMC"+i].i = i;
_root.main.containerMC1._x = 0;
_root.main.containerMC1._y = 0;
var picWidth = _root.main.containerMC1._width;
_root.main.containerMC2._x = picWidth;
_root.main.containerMC2._y = 0;
var picWidth2 = _root.main.containerMC1._width+_root.main.containerMC2._width;
_root.main.containerMC3._x = picWidth2;
_root.main.containerMC3._y = 0;
var picWidth3 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width;
_root.main.containerMC4._x = picWidth3;
_root.main.containerMC4._y = 0;
var picWidth4 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width+_root.main.containerMC4._width;
_root.main.containerMC5._x = picWidth4;
_root.main.containerMC5._y = 0;
var picWidth5 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width+_root.main.containerMC4._width+_root.main.containerMC5._width;
_root.main.containerMC6._x = picWidth5;
_root.main.containerMC6._y = 0;
var picWidth6 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width+_root.main.containerMC4._width+_root.main.containerMC5._width+_root.main.containerMC6._width;
_root.main.containerMC7._x = picWidth6;
_root.main.containerMC7._y = 0;
var picWidth7 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width+_root.main.containerMC4._width+_root.main.containerMC5._width+_root.main.containerMC6._width+_root.main.containerMC7._width;
_root.main.containerMC8._x = picWidth7;
_root.main.containerMC8._y = 0;
var picWidth8 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width+_root.main.containerMC4._width+_root.main.containerMC5._width+_root.main.containerMC6._width+_root.main.containerMC7._width+_root.main.containerMC8._width;
_root.main.containerMC9._x = picWidth8;
_root.main.containerMC9._y = 0;
var picWidth9 = _root.main.containerMC1._width+_root.main.containerMC2._width+_root.main.containerMC3._width+_root.main.containerMC4._width+_root.main.containerMC5._width+_root.main.containerMC6._width+_root.main.containerMC7._width+_root.main.containerMC8._width+_root.main.containerMC9._width;
_root.main.containerMC10._x = picWidth9;
_root.main.containerMC10._y = 0;
}
}
};
};
if (_root.welke=="messagerie") {
for (i=0; i<10; i++) {
_root.main["containerMC"+i].loadPic(["images/men/messagerie/0"+i]+".jpg");
}
}
if (_root.welke=="pantofola") {
for (i=0; i<10; i++) {
_root.main["containerMC"+i].loadPic(["images/shoes/pantofola/0"+i]+".jpg");
}
}
if (_root.welke=="anna") {
for (i=0; i<10; i++) {
_root.main["containerMC"+i].loadPic(["images/woman/anna/0"+i]+".jpg");
}
}{