3 Replies Latest reply on Jul 23, 2010 8:03 AM by Ned Murphy

    Appending variable to instance name

    aditi_bk Level 1



      I have a very basic question. I am trying to get all the button instances to become invisible on the screen. They are named img1 to img30. I thought of using a while loop to quickly run through them. The code within img1 button is:


      var i:Number = 2;

      while(i<=30) {


      img2._alpha = 0;




      The problem is how do I append the i after img, to replace the 2? so that the code runs through img 2 to img 30. I know the answer might be simple, but I really could use some help here.