Click around above and you will see an example using the ElasticForce, Force, and PhysicsParticle classes from the Chapter 11 Penner AS2 post
To replicate this example, add a circle MovieClip to the stage with an instance name of “ball”.
Then on the root timeline add the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import com.robertpenner.physics.PhysicsParticle; import com.robertpenner.physics.forces.ElasticForce; var p:PhysicsParticle = new PhysicsParticle(ball, ball._x, ball._y); p.setFriction(.1); var eForce:ElasticForce = new ElasticForce(130, 70, .2); p.addForce("elastic", eForce); this.onMouseDown = function() { eForce.setAnchor(this._xmouse, this._ymouse); } stop(); |