So easy, i can't do it - Changing object color

I draw a circle on the stage.

I select it and save as symbol, i call it mc_circle and “export to action script” as my_mc_cirle

I cannot get the circle to change color using what I imagine should be a 1 liner. Very frustrated

my_mc_circle.setRGB(0x0000CC);
and
mc_circle.setRGP(0x0000CC);

are doing nothing??

i fingured out a “way” to do it. but is this the only way to do it?


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

var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new Transform(my_mc_circle);
trans.colorTransform = colorTrans;

colorTrans.rgb = 0x333311; // blue
trans.colorTransform = colorTrans;

Where myCircle is the instance name of your movie clip:

import flash.geom.ColorTransform;
this.tempColourTrans = new ColorTransform();
this.tempColourTrans.rgb = 0xCC;
this.myCircle.transform.colorTransform = this.tempColourTrans;
delete this.tempColourTrans;

or:

this.myCircle.colour = new Color(this.myCircle);
this.myCircle.colour.setRGB(0xCC);

The first method is reccomended.

cool, I was looking at a tutorial here:

http://www.kirupa.com/developer/actionscript/color.htm

I thought that it was depriciated; then I realised it still is a kind of transform you put on a symbol instance. Not a physical property of the instance.

cool, I was looking at a tutorial here:

http://www.kirupa.com/developer/actionscript/color.htm

I thought that it was depriciated; then I realised it still is a kind of transform you put on a symbol instance. Not a physical property of the instance.

here’s the 1 liner:

my_mycircle.colorTo(0x993333,1);

you’ll need the lacos tween class for this to work.

Cheers,

Hetlicht