The Force class provides an API for assigning physics forces to objects.
ActionScript 2.0; Flash Player 6
Property summary
Property | Description |
---|---|
value:Vector |
The value property of the Force. |
life:Number |
The life property of the Force. |
parent:PhysicsParticle |
The parent property of the Force. |
Method summary
Method | Description |
---|---|
live() : Boolean |
Causes the Force object to "live for one frame"; returns false if the force is dead, and true if alive. |
getValue() : Vector |
Gets the value of a Force instance. |
setValue(x:Number, y:Number) : Void |
Sets the value of a Force instance. |
var f:Force = new Force(-8, 0);
x:Number
- The initial x value of the force.
y:Number
- The initial y value of the force.
life:Number
- The lifespan of the force in frames; this defaults to infinity if the parameter is omitted.
Creates an instance of the Force class.
f.live();
Nothing.
Causes the Force object to "live for one frame"; returns false if the force is dead, and true if alive.
trace (f.getValue());
Nothing.
Gets the value of a Force instance.
var f:Force = new Force(-8, 0);
f.setValue(10, 10);
x:Number
- The x position of the Force.
y:Number
- The y position of the Force.
Nothing.
Sets the value of a Force instance.
trace (f.value);
The value property of the Force.
trace (f.life);
The life property of the Force.
trace (f.parent);
The parent property of the Force.