April 2009

Apr 28 2009

Changing an objects color in AS3

Posted by amandar

There are many reasons to change an objects color in flash, and these days doing everything on the timeline is just unacceptable and improbable for most cases. Luckily changing an objects color is extremely easy with the ColorTransform class.

To start out, create your object as a movie clip (for examples sake we'll keep the object on the stage) and give it an instance name. I have given mine the name square_mc. Start a new layer for your actions and label it as such and open the actions panel. In most cases we will probably want the object to be clickable, so we will set a couple of properties that make is as such.

square_mc.buttonMode = true;
square_mc.mouseChildren = false;