# How to get this old script to work in AS2

**URL:** <https://forum.kirupa.com/t/how-to-get-this-old-script-to-work-in-as2/246003>\
**Category:** Uncategorized\
**Created:** [December 6, 2007, 7:17am UTC](https://forum.kirupa.com/t/how-to-get-this-old-script-to-work-in-as2/246003 "2007-12-06T07:17:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![killahert](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@killahert](https://forum.kirupa.com/u/killahert)\
**Post date:** [December 6, 2007, 7:17am UTC](https://forum.kirupa.com/t/how-to-get-this-old-script-to-work-in-as2/246003/1 "2007-12-06T07:17:38Z")

</div>

how to get this old code to work in AS2

```auto

onClipEvent (load)
{
    buttC = new Color("_root.bg");
    baseColor = new Object();
    red = 255;
    green = 255;
    blue = 255;
    baseColor.ra = 0;
    baseColor.ga = 0;
    baseColor.ba = 0;
}
onClipEvent (enterFrame)
{
    redDiff = red - baseColor.rb;
    greenDiff = green - baseColor.gb;
    blueDiff = blue - baseColor.bb;
    baseColor.rb = baseColor.rb + redDiff / 4;
    baseColor.gb = baseColor.gb + greenDiff / 4;
    baseColor.bb = baseColor.bb + blueDiff / 4;
    buttC.setTransform(baseColor);
}

```

and my buttons would have this old code too:

```auto

on (rollOver) {
    action.red = 152;
    action.green = 152;
    action.blue = 104;
    action2.red = 255;
    action2.green = 255;
    action2.blue = 255;
    action3.red = 255;
    action3.green = 255;
    action3.blue = 255;
}

```
