5 Replies Latest reply on Jun 22, 2009 10:13 AM by Steven Atkin

    Setting text in a dynamic text field

    Steven Atkin



      I'm having difficulty setting the text of a dynamic text field when using an if statement.


      I have a gallery and thumbnails, which gives each image a picNum, ie 1, 2 etc;


      When I click on the thumbnails, it sets the picNum accordingly.


      What I want to do is set the caption depending upon my picNum, so I set a function to change the caption depending upon the picNum that is called when the thumbnail is clicked.  Ie.

      caption = function() {

           if(picNum=1) {_root.caption.text = "image 1 caption"};

           if(picNum=2) {_root.caption.text = "image 2 caption"};



      I tried putting else if, but I got an error.


      My problem is that it doesn't change the caption being displayed when the picNum meets the criteria.  Something is obviously going wrong here, but not being great at actionscript, I don't know where I am going wrong.  The above code is a basic example of what I'm trying to do.  I've attached the actual file to show you what I'm trying to do. (Using Flash MX, publishing to Flash Player 6)


      Any help would be really appreciated.