Chopper like decceleration

Hi it’s sunday so i am experimenting again

trying to build a realistic helicopter blade movement

the acceleration works fine

but when i loose hold of the button that has been pressed
i’d like it to see reach an max value
then when the button is released it slowly deccelerates to zero

can anyone point me to what i am doing wrong?


var velocity:Number = 1;
var break:Number;
var maxvelocity:Number = 50;
velocityt.text = 0;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
    if (Key.isDown(Key.UP)) {
        velocity += 0.2;
        wiek._rotation += 1+velocity;
        trace("new :"+Math.round(velocity));
        velocityt.text = "velocity : " + Math.round(velocity);
    if (Math.round(velocity) == maxvelocity) {
            trace("final vel "+Math.round(velocity));
            velocityt.text = "velocity : " + Math.round(velocity);
            maxvel.text = "maximum reached"
            stat.text = "lift off";
            wiek._rotation = maxvelocity;
            
        } else {
            ("decceleration"+Math.round(velocity));
            brake = 7;
            wiek._rotation -= velocity/brake;
        }
    }
};
Key.addListener(keyListener);