AS3 Quick Tips: Change the Colour of a Movieclip with Actionscript 3

Flash CS3 Professional

Hello all, Another quick tip, this time on how to change the colour of a movieclip! Sweet!

Quick Code

// our new colour transform class
var myAwesomeNewColour:ColorTransform = transform.colorTransform;

// setting the new color we want (this will affect the whole object including strokes)
myAwesomeNewColour.color = 0xFF0000;

// applying the transform to our movieclip
myTestClipBeans_MC.transform.colorTransform = myAwesomeNewColour;

Or you can download these working examples. One also contains how to use the colour picker component to change the colour of a movieclip.

Peace out
Bill

Subscribe

Subscribe to our e-mail newsletter to receive updates.

  • Siraj Khan

    What if i need change just Fill color not stroke?

  • http://www.bigtallbill.co.uk Bill Nunney

    KHAN! as far as i see there is no simple way to change it. Other than converting your fill to another movieclip and targeting that.

  • Guest

    Awesomeness (x2)

  • http://www.coursesweb.net OnLine

    Hy,
    Thank you for this tutorial, very quick to learn :) .