I am using the AS from this tutorial on a bouncing ball that you can drag & drop
http://orangesplotch.com/blog/flash-bouncing-ball-tutorial/
I have added a basketball net mc that is stopped on frame1 that is a frame by frame animation of the net expanding. I am trying to figure out how to realistically cause the animated net to play when the basketball is dragged & dropped into the net.
on(press) {
this._freefall = false;
this._momentumY = 0;
this.startDrag(false);
}
on(release, releaseOutside) {
this._freefall = true;
this.stopDrag();
}
onClipEvent(load) {
this._freefall = true;
this._momentumY = 0;
this._accelerationY = 2.0;
this._floorElasticity = 0.75;
this._floorY = 290;
this._bounceThreshold = 3;
}
onClipEvent(enterFrame) {
if (this._freefall) {
this._y += this._momentumY;
this._momentumY += this._accelerationY;
// bounce it off the floor if it has hit it
if (this._y > this._floorY) {
this._y = this._floorY;
this._momentumY = -(this._momentumY * this._floorElasticity) + this._bounceThreshold;
// keep it from jiggling infinitely
if (Math.abs(this._momentumY) <= this._bounceThreshold) {
this._momentumY = 0;
}
}
}
}