Getting the RGB value of a MovieClip in as3

Its pretty annoying when something changes, and you cannot do the things you could previously the way you know. But some things change for the better 🙂

Its pretty common to wanting to know the RGB value of a movie clip at runtime. This could be for a coloring program that you are building or a game or something better yet. It seems like the previous method of extracting RGB information in as2 with Color class is gone in as3. But there is a better method i suppose with as3.

As2 Version:

var cl:Color = new Color(this.instance);
trace(cl.getRGB().toString(16));

As3 Version:

import flash.geom.ColorTransform;
import flash.geom.Transform;
trace(instance.transform.colorTransform.color.toString(16));

Note: RGB information will be available only if you have tinted the movieclip. if you want the true color, better try snapshotting it with BitmapData class “draw” method and querying for  pixel colors using “getPixel” etc: