# Steady speed decrease

**URL:** https://forum.kirupa.com/t/steady-speed-decrease/149719
**Category:** Uncategorized
**Created:** [May 31, 2005, 8:26pm UTC](https://forum.kirupa.com/t/steady-speed-decrease/149719 "2005-05-31T20:26:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fasterthanlight](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fasterthanlight](https://forum.kirupa.com/u/fasterthanlight)
#### Post date: [May 31, 2005, 8:26pm UTC](https://forum.kirupa.com/t/steady-speed-decrease/149719/1 "2005-05-31T20:26:26Z")

</div>

I’m using the following code to spin a couple stars on the stage when the mouse rolls over them. Can’t figure out how to make the stars slowly decrease in speed after the user rolls off though.

```auto
var stars:Array = [star1, star2, star3, star4, star5];
//-------------------------------------------------------//
for (s=0; s<stars.length; s++) {
    stars[s].onRollOver = sOver;
    stars[s].onRollOut = onDragOut=sOut;
    stars[s].useHandCursor = false;
}
function sOver() {
    if (starCond eq "t") { //---Disregard this if statement, deals with something else
        randInc = Math.floor(random(15));
        this.onEnterFrame = function() {
            this._rotation += randInc+1;
        };
    }
}
function sOut() {
    this._rotation += 0;
    delete this.onEnterFrame;
}

```

My footer uses the same effect.
