5 Replies Latest reply on Dec 17, 2009 7:13 AM by Rothrock

    changing the color of MC changes the color of the Text

    Tal770

      My buttonMC is build of:

      1. shape (a rectangle gray color) converted to MC named = Bar

      2. (on top of 1) DynamicText named = buttonText converted to MC named = buttText

      in order to change the color of the shape I decleard a veriable

       

      cButton = new Color(this.Bar);

       

      I then add actionscript onRollOver

       

      cButton.setRGB(nRed << 16 | nGreen << 8 | nBlue);

       

      but it also changed the color of the text

      so I added a veriable for the text field

       

      tButton = new Color(this.buttText.buttonText);

      tButton.setRGB(0xFFFFFF);

      but that didnt help

      this is bad becuse the text on the screen is un seen

      any help

      10X


       

        • 1. Re: changing the color of MC changes the color of the Text
          Tal770 Level 1

          acctually I thought if I could pinpoint on the shape and change that but

          I can only address the MC

          on the text I can address the DynamicText this.buttText.buttonText.textColor = 0xFFFFFF but it didnt help either

          I also tried this.buttText.buttonText.background=0xFFFFFF; that colored a box and the color changed as well not to white

          • 2. Re: changing the color of MC changes the color of the Text
            Rothrock Level 5

            The text field is inside the movieclip that you are changing the color of, right? Although it seems one is this.Bar and the other is this.butText.buttonText.

             

            Those paths would seem to indicate that they aren't together. So I'm confused as to why they would both change color.

             

            If one is inside the other, then the color applied to the parent clip will color all the children as well and nothing you can do to the child will change that.

             

            If that is the case you need to separate the clips inside the parent. So perhaps you would have:

             

            bar which contains artwork and textfield. You could then apply a color transformation to artwork without changing the color of textfield. But if you applied the change to bar both artwork and textfield would change.

            • 3. Re: changing the color of MC changes the color of the Text
              Tal770 Level 1

              I simplified the case a little:

              buttonMC-->Bar

                            -->DynamicText(buttonText)

              not!!!

              buttonMC-->Bar-->DynamicText(buttonText)

               

              I declared:

              colorBar = new Color(this.Bar);
              colorText = new Color(this.buttonText);

               

              if I tried:

              colorBar.setRGB(nRed << 16 | nGreen << 8 | nBlue);   = the text changed color as well

               

              then I tried:

              colorText.setRGB(nRed << 16 | nGreen << 8 | nBlue);   = the text changed color and the Bar DID NOT CHANGE

               

               

              this is a menu bar and an image is in the background and the text doesnt show properly becuse of the image colors.

               

              I'm using flash 8


              • 4. Re: changing the color of MC changes the color of the Text
                Tal770 Level 1

                My mistake heek

                 

                I had an additional declaration in the code which coused the problem!!

                colorBar = new Color(this);

                 

                thanks

                • 5. Re: changing the color of MC changes the color of the Text
                  Rothrock Level 5

                  Glad that worked out for you because there was no reason in the code you provided that should have caused both of those to change.

                   

                  For the future you might want to look into using the ColorTransform class. As the Color class is depreciated. With that (or with the setTransform method of the Color class) you can do more complex transforms where you change one color to this and another color to that, but it involves some rather (to me anyways) difficult math to control precisely.

                   

                  BTW, if you can would you mind marking my post helpful? I'm a sucker for points!