# Generate random tintcolor with setTint?

**URL:** <https://forum.kirupa.com/t/generate-random-tintcolor-with-settint/255919>\
**Category:** Uncategorized\
**Created:** [March 28, 2008, 9:47am UTC](https://forum.kirupa.com/t/generate-random-tintcolor-with-settint/255919 "2008-03-28T09:47:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nosoygringo](https://avatars.discourse-cdn.com/v4/letter/n/b77776/32.png) [@nosoygringo](https://forum.kirupa.com/u/nosoygringo)\
**Post date:** [March 28, 2008, 9:47am UTC](https://forum.kirupa.com/t/generate-random-tintcolor-with-settint/255919/1 "2008-03-28T09:47:11Z")

</div>

Using the following AS I can make my\_mc´s color change to a random one:

```auto

var colorT:ColorTransform = new ColorTransform();

addEventListener(Event.ENTER_FRAME, chgColor);

function chgColor(e:Event) {
    
    colorT.blueOffset = Math.round(Math.random() * 510) - 255;
    colorT.redOffset = Math.round(Math.random() * 510) - 255;
    colorT.greenOffset = Math.round(Math.random() * 510) - 255;

    my_mc.transform.colorTransform = colorT;    

```

Can I make a function generate a random color tint to my\_mc with setTint the same way, or should I do it another way?
