Property | Type | Description | |
---|---|---|---|
Random |
Method | Description | |
---|---|---|
abs ( float value ) : float |
Calculate the absolute value of a number.
|
|
bound ( float value, float min, float max ) : float |
Bound a number by a minimum and maximum. Ensures that this number is no smaller than the minimum, and no larger than the maximum.
|
|
ceil ( float value ) : float |
Round up to the next whole number. E.g. ceil(1.3) == 2, and ceil(-2.3) == -3.
|
|
compareClassNames ( object object1, object object2 ) : bool |
Check to see if two objects have the same class name.
|
|
computeVelocity ( float velocity, float acceleration, float drag, float max = 10000.0f ) : float |
A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
|
|
floor ( float value ) : float |
Round down to the next whole number. E.g. floor(1.7) == 1, and floor(-2.7) == -2.
|
|
formatArray ( |
Generate a comma-separated string from an array. Especially useful for tracing or other debug output.
|
|
formatMoney ( float amount, bool showDecimal = true, bool englishStyle = true ) : string |
Automatically commas and decimals in the right places for displaying money amounts. Does not include a dollar sign or anything, so doesn't really do much if you call say
|
|
formatTicks ( long startTicks, long endTicks ) : string |
Takes two "ticks" timestamps and formats them into the number of seconds that passed as a String. Useful for logging, debugging, the watch window, or whatever else.
|
|
formatTime ( ulong seconds, bool showMS = false ) : string |
Format seconds as minutes with a colon, an optionally with milliseconds too.
|
|
getClass ( string name ) : object |
Look up a
|
|
getClassName ( object obj, bool simple = false ) : string |
Get the
|
|
getHSB ( uint color, |
Loads an array with the HSB values of a Flash
|
|
getRGBA ( uint color, |
Loads an array with the RGBA values of a Flash
|
|
getRandom ( |
Fetch a random entry from the given array. Will return null if random selection is missing, or array has no entries.
|
|
getTicks ( ) : long |
Just grabs the current "ticks" or time in milliseconds that has passed since Flash Player started up. Useful for finding out how long it takes to execute specific blocks of code.
|
|
makeColor ( uint red, uint green, uint blue, float alpha = 1.0f ) : uint |
Generate a Flash
|
|
makeColorFromHSB ( float hue, float saturation, float brightness, float alpha = 1.0f ) : uint |
Generate a Flash
|
|
max ( float number1, float number2 ) : float |
Figure out which number is larger.
|
|
min ( float number1, float number2 ) : float |
Figure out which number is smaller.
|
|
openURL ( string url ) : void |
Opens a web page in a new tab or window. MUST be called from the UI thread or else badness.
|
|
rotatePoint ( float x, float y, float pivotX, float pivotY, float angle, |
Rotates a point in 2D space around another point by the given angle.
|
|
round ( float value ) : float |
Round to the closest whole number. E.g. round(1.7) == 2, and round(-2.3) == -2.
|
|
shuffle ( |
Shuffles the entries in an array into a new random order.
|
|
srand ( float seed ) : float |
Generates a random number based on the seed provided.
|
Method | Description | |
---|---|---|
getAngle ( |
Calculates the angle between two points. 0 degrees points straight up.
|
|
getDistance ( |
Calculate the distance between two points.
|
public static abs ( float value ) : float | ||
value | float | Any number. |
return | float |
public static bound ( float value, float min, float max ) : float | ||
value | float | Any number. |
min | float | Any number. |
max | float | Any number. |
return | float |
public static ceil ( float value ) : float | ||
value | float | Any number. |
return | float |
public static compareClassNames ( object object1, object object2 ) : bool | ||
object1 | object | The first object you want to check. |
object2 | object | The second object you want to check. |
return | bool |
public static computeVelocity ( float velocity, float acceleration, float drag, float max = 10000.0f ) : float | ||
velocity | float | Any component of velocity (e.g. 20). |
acceleration | float | Rate at which the velocity is changing. |
drag | float | Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set. |
max | float | An absolute value cap for the velocity. |
return | float |
public static floor ( float value ) : float | ||
value | float | Any number. |
return | float |
public static formatArray ( |
||
anyArray | Any Array object. |
|
return | string |
public static formatMoney ( float amount, bool showDecimal = true, bool englishStyle = true ) : string | ||
amount | float | How much moneys (in dollars, or the equivalent "main" currency - i.e. not cents). |
showDecimal | bool | Whether to show the decimals/cents component. Default value is true. |
englishStyle | bool | Major quantities (thousands, millions, etc) separated by commas, and decimal by a period. Default value is true. |
return | string |
public static formatTicks ( long startTicks, long endTicks ) : string | ||
startTicks | long | The first timestamp from the system. |
endTicks | long | The second timestamp from the system. |
return | string |
public static formatTime ( ulong seconds, bool showMS = false ) : string | ||
seconds | ulong | The number of seconds (for example, time remaining, time spent, etc). |
showMS | bool | Whether to show milliseconds after a "." as well. Default value is false. |
return | string |
public static getClass ( string name ) : object | ||
name | string | The String name of the Class you are interested in. |
return | object |
public static getClassName ( object obj, bool simple = false ) : string | ||
obj | object | The Object object in question. |
simple | bool | Returns only the class name, not the package or packages. |
return | string |
public static getHSB ( uint color, |
||
color | uint | The color you want to break into components. |
result | An optional parameter, allows you to use an array that already exists in memory to store the result. | |
return |
public static getRGBA ( uint color, |
||
color | uint | The color you want to break into components. |
result | Results An optional parameter, allows you to use an array that already exists in memory to store the result. | |
return |
public static getRandom ( |
||
objects | A Flash array of objects. | |
startIndex | uint | Optional offset off the front of the array. Default value is 0, or the beginning of the array. |
length | uint | Optional restriction on the number of values you want to randomly select from. |
return | object |
public static makeColor ( uint red, uint green, uint blue, float alpha = 1.0f ) : uint | ||
red | uint | The red component, between 0 and 255. |
green | uint | The green component, between 0 and 255. |
blue | uint | The blue component, between 0 and 255. |
alpha | float | How opaque the color should be, either between 0 and 1 or 0 and 255. |
return | uint |
public static makeColorFromHSB ( float hue, float saturation, float brightness, float alpha = 1.0f ) : uint | ||
hue | float | A number between 0 and 360, indicating position on a color strip or wheel. |
saturation | float | A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant. |
brightness | float | A number between 0 and 1, indicating how bright the color should be. 0 is black, 1 is full bright. |
alpha | float | How opaque the color should be, either between 0 and 1 or 0 and 255. |
return | uint |
public static max ( float number1, float number2 ) : float | ||
number1 | float | Any number. |
number2 | float | Any number. |
return | float |
public static min ( float number1, float number2 ) : float | ||
number1 | float | Any number. |
number2 | float | Any number. |
return | float |
public static openURL ( string url ) : void | ||
url | string | The address of the web page. |
return | void |
public static rotatePoint ( float x, float y, float pivotX, float pivotY, float angle, |
||
x | float | The X coordinate of the point you want to rotate. |
y | float | The Y coordinate of the point you want to rotate. |
pivotX | float | The X coordinate of the point you want to rotate around. |
pivotY | float | The Y coordinate of the point you want to rotate around. |
angle | float | Rotate the point by this many degrees. |
point | Optional FlxPoint to store the results in. |
|
return |
public static round ( float value ) : float | ||
value | float | Any number. |
return | float |
public static shuffle ( |
||
objects | A Flash Array object containing...stuff. |
|
howManyTimes | uint | How many swaps to perform during the shuffle operation. Good rule of thumb is 2-4 times as many objects are in the list. |
return |
public static srand ( float seed ) : float | ||
seed | float | A number between 0 and 1, used to generate a predictable random number (very optional). |
return | float |