# Dynamic text problems

**URL:** https://forum.kirupa.com/t/dynamic-text-problems/7471
**Category:** flash
**Created:** [October 31, 2002, 7:36pm UTC](https://forum.kirupa.com/t/dynamic-text-problems/7471 "2002-10-31T19:36:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jagreen78](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jagreen78](https://forum.kirupa.com/u/jagreen78)
#### Post date: [October 31, 2002, 7:36pm UTC](https://forum.kirupa.com/t/dynamic-text-problems/7471/1 "2002-10-31T19:36:57Z")

</div>

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???

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 1, 2002, 2:47am UTC](https://forum.kirupa.com/t/dynamic-text-problems/7471/2 "2002-11-01T02:47:13Z")

</div>

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”;  
}
