Case/switch & photo gallery

I’m working with the photo gallery tutorial and I’m adding in an array of captions to go under the photo. I’m using case/switch and it’s not working. It displays the first text (when pIndex=0) but none of the others. :puzzle:

I’m pretty sure the code is sound and I’m assuming that since it shows the first one that I did the dynamic text field right.

I guess I’m putting it in the wrong place ?? I have tried all sorts of places…

here’s the code:

switch (pIndex) //i also tried “this.pIndex”
{
case 0:
caption.text = “Here’s the first picture”;
break;
case 1:
caption.text = “here’s pic 2”;
break;
case 2:
caption.text = “and now pic 3”;
break;
default:
break;
}

this.createTextField(“caption”,1,10,10,150,30);
fmtEmphasis = new TextFormat();
fmtEmphasis.bold = true;
fmtEmphasis.size = 15;
fmtEmphasis.font = “Tahoma”;
caption.setTextFormat(fmtEmphasis);

I am no actionscript expert (not even close). I’m a php programmer so I get the logic but still don’t know much about what I’m doing…

any help would be great!