# Greyscale to Colour Actionscript Example

**URL:** https://forum.kirupa.com/t/greyscale-to-colour-actionscript-example/205699
**Category:** flash
**Created:** [November 1, 2006, 2:43am UTC](https://forum.kirupa.com/t/greyscale-to-colour-actionscript-example/205699 "2006-11-01T02:43:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wackizzy](https://avatars.discourse-cdn.com/v4/letter/w/59ef9b/32.png) [@wackizzy](https://forum.kirupa.com/u/wackizzy)
#### Post date: [November 1, 2006, 2:43am UTC](https://forum.kirupa.com/t/greyscale-to-colour-actionscript-example/205699/1 "2006-11-01T02:43:16Z")

</div>

After scowering the net for quite sometime I’ve managed to come up with a way to convert an image from greyscale to colour in actionscript.

```auto

import flash.filters.ColorMatrixFilter;
var nocolour:Array = [0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0];
var colour:Array = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];
var greyscale:ColorMatrixFilter = new ColorMatrixFilter(nocolour);
var fullcolour:ColorMatrixFilter = new ColorMatrixFilter(colour);

target_mc.filters = [greyscale];

target_mc.onRollOver = function() {
        this.onEnterFrame = function () {
                this.filters = [fullcolour];
            }
        };
        target_mc.onRollOut = function() {
            this.onEnterFrame = function () {
                this.filters = [greyscale];
            }
};

```

The above code is basically setting the **target\_mc** movieclip to _greyscale_ by default, and then when you **RollOver** it changes to _full colour_, again **RollOut** changes back to _greyscale_.

My question for the guru’s is, how would you go about fading the transition, instead of it being just a straight jump?
