Force (com.robertpenner.physics.Force)

com.robertpenner.physics.Force
class Force

The Force class provides an API for assigning physics forces to objects.

Availability:

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.

Force(x:Number, y:Number, life:Number)

Usage


var f:Force = new Force(-8, 0);

Parameters

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.

Description

Creates an instance of the Force class.


live() : Boolean

Usage


f.live();

Parameters

Returns

Nothing.

Description

Causes the Force object to "live for one frame"; returns false if the force is dead, and true if alive.


getValue() : Vector

Usage


trace (f.getValue());

Parameters

Returns

Nothing.

Description

Gets the value of a Force instance.


setValue(x:Number, y:Number) : Void

Usage


var f:Force = new Force(-8, 0);
f.setValue(10, 10);

Parameters

x:Number - The x position of the Force.

y:Number - The y position of the Force.

Returns

Nothing.

Description

Sets the value of a Force instance.


value : Vector

Usage


trace (f.value);

Description

The value property of the Force.


life : Number

Usage


trace (f.life);

Description

The life property of the Force.


parent : PhysicsParticle

Usage


trace (f.parent);

Description

The parent property of the Force.