KoolMoves AS3 API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class MathFn

Package | km.math
Class | public final class MathFn

The MathFn class contains math functions not available from the Math class.
The MathFn class should not be instantiated !

Public Methods

| Method | Defined by
--- | --- | ---
|  | limit(val:*, min:*, max:*):* [static] Limit a value between a min and max value. | MathFn
|  | sgn(val:*):int [static] Returns the sign of a value (-1, 0 or 1). | MathFn

Method detail

limit | () | method

`public static function limit(val:*, min:*, max:*):*`

Limit a value between a min and max value.

Parameters

| `val:*` — Value to limit.
| `min:*` — Minimum allowed value.
| `max:*` — Maximum allowed value.

Returns

| `*` — The result of the limit function.

Example

     import km.math.*;

     var v:int = 5;
     v = MathFn.limit(v, 1, 4);

sgn | () | method |

`public static function sgn(val:*):int`

Returns the sign of a value (-1, 0 or 1).

Parameters

| `val:*`

Returns

| `int`

Last update : 04/05/2008