Making simple image viewer, Pls hlp with code

Making simple image viewer, Pls hlp with code

Post by mout1 » Thu, 12 Jul 2007 10:12:19

Ok here is the code that I use.
Code from Frame1:
________________________
var foofie = " *** ";
var numbr = 11;
----------------------------------------
Code from a Button on frame 1:
---------------------------------------------------------------
on (release) {
loadMovieNum(foofie + numbr + ".jpg", 4);
var numbr = numbr + 1;
}
-----------------------------------------------------------------

I have 3 images called, *** 11, *** 12, *** 13. Once I click the button, it
will load the next image because the var "numbr" is ++'d to go from *** 11 to
*** 12 etc...

I plan to put this image viewer on a web server, and I don't want to have to
edit the .FLA file every time I upload a new picture. How can I fix this code
so I can either, update a .txt file (or similar), or it can check when there
are no more images in the sequence and then start back at *** 11?

Thanks for your helps!

 
 
 

Making simple image viewer, Pls hlp with code

Post by kgla » Thu, 12 Jul 2007 13:01:20

in a text file assign a variable to the maximum numbr that corresponds with an
image. for example:

// numbr.text:
maxNumbr=13

// then in your swf you can use:



//Code from Frame1:
//________________________
var lv:LoadVars=new LoadVars();
lv.onLoad=function(){
maxNumbr = this.maxNumbr;
}
var foofie = " *** ";
var numbr = 11;
//----------------------------------------
//Code from a Button on frame 1:
//---------------------------------------------------------------
on (release) {
loadMovieNum(foofie + numbr + ".jpg", 4);
var numbr = numbr + 1;
if(numbr>maxNumbr){
numbr=11;
}
}