3 Replies Latest reply on Sep 26, 2006 8:43 PM by abeall

    Modify all instances of a movie clip

    mcarlson
      I'd like to modify all instances of a movieclip when I publish a movie. For instance, I have a "red ball" movieclip in the library which is used throughout the movie in various animations. I'd like to use actionscript in the initialization of the movie to change the color of that clip so that every instance of it becomes blue instead of red. I know there's a way to do this, I just can't remember how. Any help?
      Thanks.
        • 1. Re: Modify all instances of a movie clip
          coldMiner
          Paste this on the timeline frame 1, and click on the red square
          • 2. Re: Modify all instances of a movie clip
            kglad Adobe Community Professional & MVP
            you can't modify a library movieclip using actionscript. you can modify each instance of that movieclip (after the instance is instantiated) using actionscript.
            • 3. Re: Modify all instances of a movie clip
              abeall Level 3
              If you are using AS2.0 you could try making it a class, then you can modify all instances.

              Go to your library, right click the red ball movie clip, click Linkage, and give 'AS2.0 class' a name, such as "RedBall"

              Now, in the same director as your .fla, create a .as file(Flash can make .as files, or any text editor) with the same name you gave the class(same case as well), in ex. "RedBall.as", and put this in it:

              class RedBall extends MovieClip{
              function redball(){
              new Color(this).setRGB(0x0000bb);
              }
              }

              Now all your RedBall instances will be blue... also, the Color object is deprecated in Flash 8 if you want to use the colorTransfrom object...

              However, unless there's something else more dynamic you are doing, there's no reason to do the above when you could just edit the Symbol in the .fla to be a blue ball.