| Package | Top Level |
| Class | public final class uint |
| Inheritance | uint Object |
The range of values represented by the uint class is 0 to 4,294,967,295 (2^32-1).
You can create a uint object by declaring a variable of type uint and assigning the variable a literal value. The default value of a variable of type uint is 0.
The uint class is primarily useful for pixel color values (ARGB and RGBA) and other situations where the int data type does not work well. For example, the number 0xFFFFFFFF, which represents the color value white with an alpha value of 255, can't be represented using the int data type because it is not within the valid range of the int values.
The following example creates a uint object and calls the
toString() method:
var myuint:uint = 1234; trace(myuint.toString()); // output: 1234
The following example assigns the value of the MIN_VALUE
property to a variable without the use of the constructor:
var smallest:uint = uint.MIN_VALUE; trace(smallest.toString()); // output: 0View the examples. See also
| int, Number |
| Property | Defined by | ||
|---|---|---|---|
| MAX_VALUE : uint = 4294967295 [static]
The largest representable 32-bit unsigned integer, which is 4,294,967,295.
| uint | ||
| MIN_VALUE : uint = 0 [static]
The smallest representable unsigned integer, which is
0. | uint | ||
| Function | Defined by | ||
|---|---|---|---|
|
Creates a new uint object.
| uint | ||
![]() |
Indicates whether an object has a specified property defined.
| Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter.
| Object | |
![]() |
Indicates whether the specified property exists and is enumerable.
| Object | |
![]() |
Sets the availability of a dynamic property for loop operations.
| Object | |
|
Returns the string representation of a uint object.
| uint | ||
|
Returns the primitive uint type value of the specified
uint object.
| uint | ||
public static const MAX_VALUE:uint = 4294967295
uint values:
trace("uint.MIN_VALUE = " + uint.MIN_VALUE);
trace("uint.MAX_VALUE = " + uint.MAX_VALUE);
The values are:
uint.MIN_VALUE = 0 uint.MAX_VALUE = 4294967295
public static const MIN_VALUE:uint = 0
0.
Example
uint values:
trace("uint.MIN_VALUE = " + uint.MIN_VALUE);
trace("uint.MAX_VALUE = " + uint.MAX_VALUE);
The values are:
uint.MIN_VALUE = 0 uint.MAX_VALUE = 4294967295
public function uint(num:Object)
new uint() constructor is primarily used
as a placeholder. A uint object is not the same as the
uint() function, which converts a parameter to a primitive value.
Parameters
num:Object — The numeric value of the uint object being created,
or a value to be converted to a number. If num is not provided,
the default value is 0.
|
var n1:uint = 3; var n2:uint = new uint(10);
public function toString(radix:uint):String
radix:uint — Specifies the numeric base (from 2 to 36) to use for the
number-to-string conversion. If you do not specify the radix
parameter, the default value is 10.
|
String —
The string representation of the uint object.
|
radix
parameters and returns a string value with the corresponding
representation of the number 9:
var myuint:uint = 9; trace(myuint.toString(2)); // output: 1001 trace(myuint.toString(8)); // output: 11The following example creates hexadecimal values:
var r:uint = 250; var g:uint = 128; var b:uint = 114; var rgb:String = "0x" + r.toString(16) + g.toString(16) + b.toString(16); trace(rgb); // output: 0xFA8072 (Hexadecimal equivalent of the color 'salmon')
public function valueOf():uint
uint —
The primitive uint type value of this uint
object.
|
numSocks object.
var numSocks:uint = 2; trace(numSocks.valueOf()); // output: 2
i within a for loop,
which prints out the digits 0 to 9 (since uint defaults to 0).
package {
import flash.display.Sprite;
public class UintExample extends Sprite {
public function UintExample() {
for(var i:uint; i < 10; i++) {
trace(i);
}
}
}
}