Dynamic jpeg loader

How do edit the code in the photo gallery so that I can search for next jpg 1.jpg, 2.jpg etc and then when it hits the last one it will start to the first one

I have it set to
pic = “1”
pic + “.jpg”

this way I can change the number of pics in the folder without changing the code?

It’s done already. With this very nice line in the prototype changePhoto :

this.pIndex = (this.pIndex+d)%this.pArray.length;

Until the last picture, the right part will return pIndex, and just for the last picture, it will return 0, so you’ll be at the beginning again.

% is a little bit strange : it’s the rest of the division.

pom :asian:

So one minute I can have 10 jpegs and the next day 20 and it will work the same without editing the file?

I understand the array, I do not want one! that way it can be truely dynamic and not a static array!

It means that if you want to change something, all you have to do is change the array and upload the corresponding pictures. How more dynamic can it get ?

pom :asian:

What I am trying to figure out is to enter code that will automatically keep adding 1 to .jpg until there is no file and then it will start over. That way I can change the folder contents WITHOUT CHANGING THE CODE every single day.

You can’t do it with Flash only. You’ll have to use backend. PHP for instance. Not too hard, but you must have a server that supports PHP (or ASP).

pom :asian:

Is there something in actionscript that is like 'error handleing" that way is can say along the linds…if attempt to retrieve image failes then start over with pic = 1?

Nope. You have to use PHP, man. Sorry:*(

pom :asian:

Thanks!

I guess I will have to stick to a static amount of pics and then just change them instead…

Thanks again…

hmm… PHP is a good answer, and probably the one that will offer the most flexibility.

You could load array from variables in a text file, that way, the array is dynamic, so you can leave your swf alone. When you add pics to the folder, add some values to the txt file and have flash build the array from the items in the text file. Otherwise, if you want to be totally dynamic, build your MySQL database where you will put your pics, insert new pictures with php/html front end, this will automatically assign the new pic a new name in sequence (lastnameused+1). Then, have php build the array for you and feed it to flash.

That is about as dynamic as you can get…

you may still have to take the pictures yourself! ahahahahahaah

just kidding, dude.

Iammontoya how are you formatting the text file to have flash read the array properly?