5 Replies Latest reply on Jun 22, 2012 1:17 PM by esdebon

    Turning if statement into variable?

    witherton Level 1

      I have a group of movie clips on the stage that belong to an array called "bttns". All consist of the same  3 frame labels: "no_color", "red"and "blue" . When the program starts, each of the buttons is either on frame "no_color" or "red". Their currentframes are determined by a randomizer code that fires off at start. I want a second randomizer to select one button  from an array of "red" buttons to turn "blue". I've tried a few different things with for loops and while loops, but none does exactly what I want in an elegant way.


      When I trace the the following function, I get exactly the array I want.



      for(var i:uint=0; i<bttns.length; i++)

      if (bttns[i].currentLabel != "blue"){trace(bttns[i].name)}



      However, I don't know how to turn this code into a variable. If I use the "!=" tag in a variable definition, it traces as true or false.Is it possible to do so?