PDA

View Full Version : Simple question/problem



SoloDesignz
September 3rd, 2003, 11:32 AM
All im trying to do is everytime I press a "next" button i want it to add 1 to a variable and when i press "back" it subtracts 1 ... theni can use that number to pull up a "image" + variable + ".jpg" and also display which picture is open in a textbox

thanks alot

radicaljugnu
September 3rd, 2003, 11:36 AM
on(press){
x++
_root.movieclip.loadMovie(("image"+x)+".jpg")
}
or something like that.

SoloDesignz
September 3rd, 2003, 11:38 AM
So then to subtract i guess it would be

on(press){
x--

?

SoloDesignz
September 3rd, 2003, 11:43 AM
that x++ doesnt seem to work right.. ??

Voetsjoeba
September 3rd, 2003, 11:53 AM
If you're using Flash MX, place this on your main timeline:

x=0; //I suppose there is an image0.jpg
next.onRelease = function(){
x++
l = "image"+x+".jpg";
holder.loadMovie(l)
}
previous.onRelease = function(){
x--
l = "image"+x+".jpg";
holder.loadMovie(l)
}

SoloDesignz
September 3rd, 2003, 11:53 AM
Got it.... thank alot!!

Voetsjoeba
September 3rd, 2003, 12:24 PM
No problem ;) That code will keep increasing and decreasing. If you want it to load the first one again after the last one, I need to know the filename of the last and the first image.