Picture Gallery and thumbnail doubts

Here’s the situation: I’m making a script that will dynamically load JPG’s from a file and will eventually display each JPG’s thumbnail them side by side. I’ve got the code going and would like to know any suggestions for corrections.
[AS]
**// Importing Images

p = 0;
x = 20;
y = 20;
for(i=0;i<4;i++){
_root.createEmptyMovieClip(“clip”+i, i+1)
loadMovie(“pic”+i+’.jpg’,_root[“clip”+i]);
_root[“clip”+i]._x = x;
_root[“clip”+i]._y = y;

            //attempt to change position for next image
             x = +100;
 y = +100;

}

_root.onEnterFrame = function(){
            _root["pic"+p+'.jpg'].swapDepths(_root);
             
                         //attempt to create thumbnails
                         if(this._width&gt;768){
	this._width = 150;
                            this._height = 113;
             }
             else {
	this._width = 150;
                            this._height = 200;
             }
            p++;
}

**[/AS]
Right now I’m having troubles with the resizing of images: the if statement doesn’t seem to work (or maybe resizing in flash distorts the images). Any tips or suggestions for the code?

Thanks!! :pleased:

How could we change this code to just load the images in their original size, creating a link on then to open a swf file with the same name as the picture?
e.g. loading pic01 would create a button on it to load pic01.swf on container_mc

Thanks

Although, I don’t know how to do it, I do understand what he is asking.

He is wanting to have it that when this script runs and pictures are loaded, then instead of displaying those pics on the screen, it would actually create a button and put it on the screen instead.

Then clicking on said button would then display the associated loaded picture.

Again, I am still learning code stuff, so I wouldnt want to post horribly wrong code, but from what I can tell,

underneath this code:


this.createEmptyMovieClip("clip"+i+"_mc", i+1);
        this["clip"+i+"_mc"].createEmptyMovieClip("foto_mc", 0);
        this["clip"+i+"_mc"]["foto_mc"].loadMovie("fotos/pic"+i+".jpg");

you would do a create new instance of a button MC and give it property _name = (“pic”+i)

oh and you would also want to do something in terms of setting the visibility of the loaded pic to false.

Then on pressrelease of the produced button change the visibility to true

Hey ghjr,

Do you have the final code?
The one with the loading before showing the picture…

Thanks !! :beam:

neuhaus3000