6 Replies Latest reply on Apr 9, 2008 1:34 AM by Newsgroup_User

    concatenating variables

    brian914 Level 1
      I am trying to use a variable in a for loop. I have the for loop in a function and I am passing a number into it. The variable is called whichScreen and would be 1, 2, or 3.

      My variables look like this:
      var imgsScreen0:Number = 1;
      var imgsScreen1:Number = 2;
      var imgsScreen2:Number = 3;

      I was thinking I could do something like this with the for loop, but it does not seem to want to work?
      for(var i:Number = 0; i < "imgsScreen" + whichScreen; i++){
      ...

      What am I doing wrong?

      Thanks a lot for any help.