Recipe 3.8 Restoring a Movie Clip's Original Color

3.8.1 Problem

You want to restore the original symbol's color values to a movie clip.

3.8.2 Solution

Reset the transformation object using the setTransform( ) method of the Color object that targets the movie clip.

3.8.3 Discussion

No matter what changes you made to a movie clip's color using setTransform( ) and setRGB( ) (or made at authoring time), you can restore the original color values using a reset transform object (one with 100 for the percentages and 0 for the offsets):

resetTransform = {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0};

When this reset transform object is passed to the setTransform( ) method, the colors in the targeted movie clip are set to those of the Library symbol on which the clip is based:

// Create the Color object.
my_color = new Color(myMovieClip);

// Apply a unity transformation.
resetTransform = {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0};
my_color.setTransform(resetTransform);


    Part I: Local Recipes
    Part II: Remote Recipes