Dynamic text problems

Ok, I have a variable that I define like so:

whichPic = 1;

Then I have two buttons that scroll through the pics and increments them like so:

whichPic++;

whichPic–;

Then at the bottom of my code I have if statements that try to load text into my dynamic text box name “txtName” like so:

if (whichPic==1){
txtName.text = “Name1”;
}
else if (whichPic==2){
txtName.text = “Name2”;
}

The pics scroll fine but the text does not change when you hit the next or back button???

why dont you just assign a variable (i’ll use picname) to the txtname box in it’s properties

then just make the variable=name1 in your if statement?

if (whichPic==1){
picname= “Name1”;
}
else if (whichPic==2){
picname = “Name2”;
}