PDA

View Full Version : rephrase: using variables within variables


balti
09-04-2004, 12:06 AM
please help me get some sleep..

how can i make this work?
First Frame:
var number= 1;
var url = 'Pictures/photo'+number+'.jpg'

My 'next' button:
on(press) {
number = number+1;
content.loadMovie(url);}

Problem: button loads 'Pictures/photo1' and not photo2 as i would like.
To be able to use the next button for multiple functions i have to have my url variable set up the way i have it. how can i make var url use the new value for var number?

exygen
09-05-2004, 03:24 PM
try putting this on the _root timeline and give your button an instance name "btn1_btn".

number = 1;
btn1_btn.onRelease = function(){
var url = "Pictures/photo" + number + ".jpg";
number += 1;
content.loadMovie(url);
}