Packageorg.flixel
Classpublic class FlxU



Public Properties
 PropertyDefined by
  quadTree : FlxQuadTree
[static] The last quad tree you generated will be stored here for reference or whatever.
FlxU
  roundingError : Number = 0.0000001
[static] Helps to eliminate false collisions and/or rendering glitches caused by rounding errors
FlxU
Public Methods
 MethodDefined by
  
abs(N:Number):Number
[static]
FlxU
  
ceil(N:Number):Number
[static]
FlxU
  
collide(Object1:FlxObject, Object2:FlxObject):Boolean
[static] Call this function to see if one FlxObject collides with another.
FlxU
  
computeVelocity(Velocity:Number, Acceleration:Number = 0, Drag:Number = 0, Max:Number = 10000):Number
[static] A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
FlxU
  
endProfile(Start:uint, Name:String = "Profiler", Log:Boolean = true):uint
[static] Useful for finding out how long it takes to execute specific blocks of code.
FlxU
  
floor(N:Number):Number
[static]
FlxU
  
getAngle(X:Number, Y:Number):Number
[static] Calculates the angle between a point and the origin (0,0).
FlxU
  
getClass(Name:String):Class
[static] Look up a Class object by its string name.
FlxU
  
getClassName(Obj:Object, Simple:Boolean = false):String
[static] Get the String name of any Object.
FlxU
  
getColor(Red:uint, Green:uint, Blue:uint, Alpha:Number = 1.0):uint
[static] Generate a Flash uint color from RGBA components.
FlxU
  
getColorHSB(Hue:Number, Saturation:Number, Brightness:Number, Alpha:Number = 1.0):uint
[static] Generate a Flash uint color from HSB components.
FlxU
  
getHSB(Color:uint, Results:Array = null):Array
[static] Loads an array with the HSB values of a Flash uint color.
FlxU
  
getRGBA(Color:uint, Results:Array = null):Array
[static] Loads an array with the RGBA values of a Flash uint color.
FlxU
  
max(N1:Number, N2:Number):Number
[static]
FlxU
  
min(N1:Number, N2:Number):Number
[static]
FlxU
  
openURL(URL:String):void
[static] Opens a web page in a new tab or window.
FlxU
  
overlap(Object1:FlxObject, Object2:FlxObject, Callback:Function = null):Boolean
[static] Call this function to see if one FlxObject overlaps another.
FlxU
  
random(Seed:Number):Number
[static] Generates a random number.
FlxU
  
rotatePoint(X:Number, Y:Number, PivotX:Number, PivotY:Number, Angle:Number, P:FlxPoint = null):FlxPoint
[static] Rotates a point in 2D space around another point by the given angle.
FlxU
  
setWorldBounds(X:Number = 0, Y:Number = 0, Width:Number = 0, Height:Number = 0, Divisions:uint = 3):void
[static] Call this function to specify a more efficient boundary for your game world.
FlxU
  
solveXCollision(Object1:FlxObject, Object2:FlxObject):Boolean
[static] This quad tree callback function can be used externally as well.
FlxU
  
solveYCollision(Object1:FlxObject, Object2:FlxObject):Boolean
[static] This quad tree callback function can be used externally as well.
FlxU
  
startProfile():uint
[static] Useful for finding out how long it takes to execute specific blocks of code.
FlxU
Property detail
quadTreeproperty
public static var quadTree:FlxQuadTree

The last quad tree you generated will be stored here for reference or whatever.

roundingErrorproperty 
public static var roundingError:Number = 0.0000001

Helps to eliminate false collisions and/or rendering glitches caused by rounding errors

Method detail
abs()method
public static function abs(N:Number):NumberParameters
N:Number

Returns
Number
ceil()method 
public static function ceil(N:Number):NumberParameters
N:Number

Returns
Number
collide()method 
public static function collide(Object1:FlxObject, Object2:FlxObject):Boolean

Call this function to see if one FlxObject collides with another. Can be called with one object and one group, or two groups, or two objects, whatever floats your boat! It will put everything into a quad tree and then check for collisions. For maximum performance try bundling a lot of objects together using a FlxGroup (even bundling groups together!) NOTE: does NOT take objects' scrollfactor into account.

Parameters
Object1:FlxObject — The first object or group you want to check.
 
Object2:FlxObject — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.

Returns
Boolean
computeVelocity()method 
public static function computeVelocity(Velocity:Number, Acceleration:Number = 0, Drag:Number = 0, Max:Number = 10000):Number

A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.

Parameters
Velocity:Number — Any component of velocity (e.g. 20).
 
Acceleration:Number (default = 0) — Rate at which the velocity is changing.
 
Drag:Number (default = 0) — Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set.
 
Max:Number (default = 10000) — An absolute value cap for the velocity.

Returns
Number — The altered Velocity value.
endProfile()method 
public static function endProfile(Start:uint, Name:String = "Profiler", Log:Boolean = true):uint

Useful for finding out how long it takes to execute specific blocks of code.

Parameters
Start:uint — A uint created by FlxU.startProfile().
 
Name:String (default = "Profiler") — Optional tag (for debug console display). Default value is "Profiler".
 
Log:Boolean (default = true) — Whether or not to log this elapsed time in the debug console.

Returns
uint — A uint to be passed to FlxU.endProfile().
floor()method 
public static function floor(N:Number):NumberParameters
N:Number

Returns
Number
getAngle()method 
public static function getAngle(X:Number, Y:Number):Number

Calculates the angle between a point and the origin (0,0).

Parameters
X:Number — The X coordinate of the point.
 
Y:Number — The Y coordinate of the point.

Returns
Number — The angle in degrees.
getClass()method 
public static function getClass(Name:String):Class

Look up a Class object by its string name.

Parameters
Name:String — The String name of the Class you are interested in.

Returns
Class — A Class object.
getClassName()method 
public static function getClassName(Obj:Object, Simple:Boolean = false):String

Get the String name of any Object.

Parameters
Obj:Object — The Object object in question.
 
Simple:Boolean (default = false) — Returns only the class name, not the package or packages.

Returns
String — The name of the Class as a String object.
getColor()method 
public static function getColor(Red:uint, Green:uint, Blue:uint, Alpha:Number = 1.0):uint

Generate a Flash uint color from RGBA components.

Parameters
Red:uint — Red The red component, between 0 and 255.
 
Green:uint — Green The green component, between 0 and 255.
 
Blue:uint — Blue The blue component, between 0 and 255.
 
Alpha:Number (default = 1.0) — Alpha How opaque the color should be, either between 0 and 1 or 0 and 255.

Returns
uint — The color as a uint.
getColorHSB()method 
public static function getColorHSB(Hue:Number, Saturation:Number, Brightness:Number, Alpha:Number = 1.0):uint

Generate a Flash uint color from HSB components.

Parameters
Hue:Number — A number between 0 and 360, indicating position on a color strip or wheel.
 
Saturation:Number — A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.
 
Brightness:Number — A number between 0 and 1, indicating how bright the color should be. 0 is black, 1 is full bright.
 
Alpha:Number (default = 1.0) — Alpha How opaque the color should be, either between 0 and 1 or 0 and 255.

Returns
uint — The color as a uint.
getHSB()method 
public static function getHSB(Color:uint, Results:Array = null):Array

Loads an array with the HSB values of a Flash uint color. Hue is a value between 0 and 360. Saturation, Brightness and Alpha are as floating point numbers between 0 and 1.

Parameters
Color:uint — The color you want to break into components.
 
Results:Array (default = null) — An optional parameter, allows you to use an array that already exists in memory to store the result.

Returns
Array — An Array object containing the Red, Green, Blue and Alpha values of the given color.
getRGBA()method 
public static function getRGBA(Color:uint, Results:Array = null):Array

Loads an array with the RGBA values of a Flash uint color. RGB values are stored 0-255. Alpha is stored as a floating point number between 0 and 1.

Parameters
Color:uint — The color you want to break into components.
 
Results:Array (default = null) — An optional parameter, allows you to use an array that already exists in memory to store the result.

Returns
Array — An Array object containing the Red, Green, Blue and Alpha values of the given color.
max()method 
public static function max(N1:Number, N2:Number):NumberParameters
N1:Number
 
N2:Number

Returns
Number
min()method 
public static function min(N1:Number, N2:Number):NumberParameters
N1:Number
 
N2:Number

Returns
Number
openURL()method 
public static function openURL(URL:String):void

Opens a web page in a new tab or window.

Parameters
URL:String — The address of the web page.
overlap()method 
public static function overlap(Object1:FlxObject, Object2:FlxObject, Callback:Function = null):Boolean

Call this function to see if one FlxObject overlaps another. Can be called with one object and one group, or two groups, or two objects, whatever floats your boat! It will put everything into a quad tree and then check for overlaps. For maximum performance try bundling a lot of objects together using a FlxGroup (even bundling groups together!) NOTE: does NOT take objects' scrollfactor into account.

Parameters
Object1:FlxObject — The first object or group you want to check.
 
Object2:FlxObject — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
 
Callback:Function (default = null) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject); If no function is provided, FlxQuadTree will call kill() on both objects.

Returns
Boolean
random()method 
public static function random(Seed:Number):Number

Generates a random number. NOTE: To create a series of predictable random numbers, add the random number you generate each time to the Seed value before calling random() again.

Parameters
Seed:Number — A user-provided value used to calculate a predictable random number.

Returns
Number — A Number between 0 and 1.
rotatePoint()method 
public static function rotatePoint(X:Number, Y:Number, PivotX:Number, PivotY:Number, Angle:Number, P:FlxPoint = null):FlxPoint

Rotates a point in 2D space around another point by the given angle.

Parameters
X:Number — The X coordinate of the point you want to rotate.
 
Y:Number — The Y coordinate of the point you want to rotate.
 
PivotX:Number — The X coordinate of the point you want to rotate around.
 
PivotY:Number — The Y coordinate of the point you want to rotate around.
 
Angle:Number — Rotate the point by this many degrees.
 
P:FlxPoint (default = null) — Optional FlxPoint to store the results in.

Returns
FlxPoint — A FlxPoint containing the coordinates of the rotated point.
setWorldBounds()method 
public static function setWorldBounds(X:Number = 0, Y:Number = 0, Width:Number = 0, Height:Number = 0, Divisions:uint = 3):void

Call this function to specify a more efficient boundary for your game world. This boundary is used by overlap() and collide(), so it can't hurt to have it be the right size! Flixel will invent a size for you, but it's pretty huge - 256x the size of the screen, whatever that may be. Leave width and height empty if you want to just update the game world's position.

Parameters
X:Number (default = 0) — The X-coordinate of the left side of the game world.
 
Y:Number (default = 0) — The Y-coordinate of the top of the game world.
 
Width:Number (default = 0) — Desired width of the game world.
 
Height:Number (default = 0) — Desired height of the game world.
 
Divisions:uint (default = 3) — Pass a non-zero value to set quadTreeDivisions. Default value is 3.
solveXCollision()method 
public static function solveXCollision(Object1:FlxObject, Object2:FlxObject):Boolean

This quad tree callback function can be used externally as well. Takes two objects and separates them along their X axis (if possible/reasonable).

Parameters
Object1:FlxObject — The first object or group you want to check.
 
Object2:FlxObject — The second object or group you want to check.

Returns
Boolean
solveYCollision()method 
public static function solveYCollision(Object1:FlxObject, Object2:FlxObject):Boolean

This quad tree callback function can be used externally as well. Takes two objects and separates them along their Y axis (if possible/reasonable).

Parameters
Object1:FlxObject — The first object or group you want to check.
 
Object2:FlxObject — The second object or group you want to check.

Returns
Boolean
startProfile()method 
public static function startProfile():uint

Useful for finding out how long it takes to execute specific blocks of code.

Returns
uint — A uint to be passed to FlxU.endProfile().