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);

As3 Version:

import flash.geom.ColorTransform;
import flash.geom.Transform;

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:

14 Comments - Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *