1 Reply Latest reply: Apr 22, 2012 11:54 AM by Ned Murphy RSS

    Changing frames on a button

    kkiilleerr1997

      Hello, I was going to make a level select frame in my game, and to unlock the different level, you need to complete the previous level. I've done this, but I also want an effect on my button. So if level1 completed=true, it goes red, but if it's false, it goes gray. For a movieclip, I would have used

      onClipEvent (enterFrame) {

                if (level1 == true)

                {

          this.lvl1btn.gotoAndStop(2);

                }

      }

      But that's only for movieclips, so do I have to make a pressable movieclip, or is there another way?

        • 1. Re: Changing frames on a button
          Ned Murphy MVP

          If you want a button that will stay in different states you need to use a movieclip as a button.

           

          Just a tidbit else...

           

          if(level1 == true)

           

          can be reduced to 

           

          if(level1)

           

          conditinals work based on evaluating whether what is in the parentheses is true or false, so for Boolean values you don't need to use   == true/false