3 Replies Latest reply on Jan 22, 2007 2:30 PM by kglad

    button issue

    Manolob
      I made a dynamic menu using flash. I would like for my first button to be a certain color (lets say green) when the movieClip loads, so I am using a script like this for the movieClip:

      //----------------<partyMC option>-----------------\\

      partyMC.onEnterFrame = function () {
      changeOptionColor(this, overColor);
      };

      partyMC.onRollOver = function () {
      changeOptionColor(this, overColor);

      };

      partyMC.onRollOut = function () {
      changeOptionColor(this, outColor);
      };

      partyMC.onRelease = function () {
      reActivateBtns();
      changeOptionColor(this, overColor);
      this.enabled = false;
      _level0.myMCL.loadClip("main.swf", 5);
      };
      //----------------</laMC option>-----------------\\

      I would like the color green to turn off when I press a new button, I know it doesn't change because I am using onEnterFrame, so is there an alternative script I would be able to use so when the movie loads a certain button is automatically what ever color I want?
        • 1. Re: button issue
          kglad Adobe Community Professional & MVP
          the onEnterFrame method loops repeatedly. it does not execute once when entering a frame. to remedy, just attach your code to the frame. it will execute when the frame plays.

          also, your changeOptionColor() function doesn't do anything to affect the color of the movieclip passed to it. to remedy, create a color object for your movieclip and use the setRGB() method of the color class.
          • 2. Re: button issue
            Manolob Level 1
            let me show you my whole script, this is all on one frame, and the changeOptionColor works because I set it as a variable:

            stop();

            homeMC.enabled = false;
            partyMC.enabled = false;


            //----------------<define option colors>-----------------\\
            var overColor:Number = 0x00ff00;
            //var overColor2:Number = 0xf2adbb;
            //var overColor3:Number = 0x01baed;
            var outColor:Number = 0xffffff;



            function changeOptionColor(myOption:MovieClip, myColor:Number) {
            myOption.textLabel.textColor = myColor;
            };

            //----------------<define option colors>-----------------\\

            //----------------<re-enable menu options>-----------------\\
            function reActivateBtns() {
            homeMC.enabled = true;
            partyMC.enabled = true;
            colorMC.enabled = true;
            aboutMC.enabled = true;
            checkListMC.enabled = true;
            dunnyPageMC.enabled = true;
            changeOptionColor(partyMC, outColor);
            changeOptionColor(colorMC, outColor);
            changeOptionColor(aboutMC, outColor);
            changeOptionColor(checkListMC, outColor);
            changeOptionColor(dunnyPageMC, outColor);

            };
            //----------------</re-enable menu options>-----------------\\

            //----------------<logo option>-----------------\\
            homeMC.onRelease = function () {
            reActivateBtns();
            this.enabled = false;
            _level0.myMCL.loadClip("main.swf", 5);
            };
            //----------------</logo option>-----------------\\

            //----------------<partyMC option>-----------------\\
            partyMC.onRollOver = function () {
            changeOptionColor(this, overColor);

            };

            partyMC.onRollOut = function () {
            changeOptionColor(this, outColor);
            };

            partyMC.onRelease = function () {
            reActivateBtns();
            changeOptionColor(this, overColor);
            this.enabled = false;
            _level0.myMCL.loadClip("main.swf", 5);
            };
            //----------------</laMC option>-----------------\\
            • 3. Re: button issue
              kglad Adobe Community Professional & MVP
              so, if textLabel is a textfield in your movieclips your code should work. to initialize a textfield's text color when you enter a frame just attach the appropriate code to that frame.

              for example: