# whY?

**URL:** <https://forum.kirupa.com/t/why/189208>\
**Category:** flash\
**Created:** [May 15, 2006, 3:17am UTC](https://forum.kirupa.com/t/why/189208 "2006-05-15T03:17:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickey\_cakes](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mickey\_cakes](https://forum.kirupa.com/u/mickey_cakes)\
**Post date:** [May 15, 2006, 3:17am UTC](https://forum.kirupa.com/t/why/189208/1 "2006-05-15T03:17:02Z")

</div>

why wont this code work in flash 8? it works in flash 5, but nothing higher. I cant seem to figure it out…

This is the code thats on the frame.

```auto

MovieClip.prototype.move = function(centerx, inertia, k) {
    x = -this._x+centerx;
    xp = xp*inertia+x*k;
    _x += xp;
};

```

This is the code thats on the MC.

```auto

onClipEvent (load) {
    // We define the reference point
    centerx = 0
    centery = 0
    // temporary variables used to calculate
    // the speed of the mass
    x0 = this._x;
}
onClipEvent (enterFrame) {
    if (pressing) {
        startDrag(this, false, -1000, this._y, Stage.width, this._y);
        xp = this._x-x0;
        x0 = this._x;
    } else {
        stopDrag();
        this.move(centerx, 0.9, 0.1);
    }
}

```

This is the code inside the MC on a button.

```auto

on (press) {
    pressing = 1;
}
on (releaseOutside) {
    pressing = 0;
}
on (release) {
    pressing = 0;
}

```

All it does is lets you drag the specific object to the sides and then when you let go it will snap back to place in an elastic type motion. Any help would be much appreciated. Thanks.

Jake Mize
