Posted By

adrianparr on 02/10/10


hex String colour color movieclip tint DisplayObject ColorTransform TweenLite

Versions (?)

Who likes this?

3 people have marked this snippet as a favorite


AS3 Tint a MovieClip from a Hex string e.g. "#FF0066" using TweenLite

 / Published in: ActionScript 3

Example usage ...

setTint(ball_mc, "#FF0066");

  1. import com.greensock.*;
  2. import com.greensock.plugins.*;
  3. TweenPlugin.activate([TintPlugin]);
  5. function setTint($mc:MovieClip, $hexString:String):void
  6. {
  7. var strHexDecimal:String = "0x"+ $hexString.split("#").join("");
  8. var numHexDecimal:Number = parseInt(strHexDecimal, 16);
  9.$mc, 0, {tint:numHexDecimal});
  10. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: adrianparr on March 19, 2010

NOTE: This seems to produce a colour that isn't it's full value. For example, if the movieclip you are tinting is natually white, then the tinted movieclip will be slightly pale.

You need to login to post a comment.