3 Replies Latest reply on Jan 7, 2007 6:34 PM by kglad

    Newbie Quesion: Best way to change colour of a movie

    Level 7
      Hi,

      Could someone tell me the best way to change the colour of one element of a
      movieclip in AS2?

      Say for example I had a filled white circle in the middle of a black square,
      how can I change just the colour of the circle?

      I have tried this.myColor.setRGB( color ); but that sets the entire clip to
      be of one colour. Do I need ( as I suspect ) one clip on top of another or
      is there any way of keeping details of the clip being changed?

      TIA

      Wil


        • 1. Re: Newbie Quesion: Best way to change colour of a movie
          harms239b
          Don't know if this will help, but this code changes the color of my "LOADING" text while it is loading. Should have the essential code to do what you are looking for.

          Make the white circle a movie clip and pick the following code apart to get it to change colors:

          • 2. Re: Newbie Quesion: Best way to change colour of a movie
            Level 7
            Cheers jdh,

            This is one method I'd considered.

            I'll give it a bash.

            Wil


            "jdh239" <webforumsuser@macromedia.com> wrote in message
            news:ens1vd$ahn$1@forums.macromedia.com...
            > Don't know if this will help, but this code changes the color of my
            > "LOADING"
            > text while it is loading. Should have the essential code to do what you
            > are
            > looking for.
            >
            > Make the white circle a movie clip and pick the following code apart to
            > get it
            > to change colors:
            >
            >
            >
            > stop();
            > loading.gotoAndPlay(1);
            > import flash.geom.ColorTransform;
            > import flash.geom.Transform;
            > var colorTrans:ColorTransform = new ColorTransform();
            > var trans:Transform = new Transform(loading);
            > trans.colorTransform = colorTrans;
            > loadI = setInterval(loadF, 100);
            > function loadF() {
            > percent = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
            > if (percent<=39) {
            > colorTrans.rgb = 0x0000FF;
            > // blue
            > trans.colorTransform = colorTrans;
            > } else if ((percent>39) && (percent<60)) {
            > colorTrans.rgb = 0x00FF00;
            > // green
            > trans.colorTransform = colorTrans;
            > } else if ((percent>60) && (percent<80)) {
            > colorTrans.rgb = 0xFF8000;
            > // orange
            > trans.colorTransform = colorTrans;
            > } else if ((percent>80) && (percent<99)) {
            > colorTrans.rgb = 0xFF0000;
            > // red
            > trans.colorTransform = colorTrans;
            > } else if (percent>=99) {
            > clearInterval(loadI);
            > _root.gotoAndPlay(16);
            > } else {
            > loading.gotoAndPlay(1)
            > }
            > }
            >


            • 3. Re: Newbie Quesion: Best way to change colour of a movie
              kglad Adobe Community Professional & MVP
              your white circle needs to be a movieclip. then create a color object for that movieclip ( colorObj=new Color(whiteCircleMC) ), and then you can use the color methods (like setRGB() ) on colorObj.