A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/uint.html below:

Adobe ActionScript® 3 (AS3 ) API Reference

Language Version:  ActionScript 3.0 Runtime Versions:  AIR 1.0, Flash Player 9, Flash Lite 4

The uint class provides methods for working with a data type representing a 32-bit unsigned integer. Because an unsigned integer can only be positive, its maximum value is twice that of the int class.

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()); // 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()); // 0
 

View the examples


Public Properties

  Property Defined By   constructor : Object

A reference to the class object or constructor function for a given object instance.

Object

Public Constants

  Constant 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 public function uint(num:Object) Language Version:  ActionScript 3.0 Runtime Versions:  AIR 1.0, Flash Player 9, Flash Lite 4

Creates a new uint object. You can create a variable of uint type and assign it a literal value. The 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.
Example
How to use this example

The following code constructs two new uint objects; the first by assigning a literal value, and the second by using the constructor function:

	 var n1:uint = 3;
	 var n2:uint = new uint(10);
	 
AS3 function toExponential(fractionDigits:uint):String Language Version:  ActionScript 3.0 Runtime Versions:  Flash Player 9, AIR 1.0, Flash Lite 4

Returns a string representation of the number in exponential notation. The string contains one digit before the decimal point and up to 20 digits after the decimal point, as specified by the fractionDigits parameter.

Parameters

fractionDigits:uint — An integer between 0 and 20, inclusive, that represents the desired number of decimal places. Returns
Throws RangeError — Throws an exception if the fractionDigits argument is outside the range 0 to 20.
Example  ( How to use this example )

The following example shows how

toExponential(2)

returns a string in exponential notation.


var num:Number = 315003;
trace(num.toExponential(2)); // 3.15e+5

AS3 function toFixed(fractionDigits:uint):String Language Version:  ActionScript 3.0 Runtime Versions:  Flash Player 9, AIR 1.0, Flash Lite 4

Returns a string representation of the number in fixed-point notation. Fixed-point notation means that the string will contain a specific number of digits after the decimal point, as specified in the fractionDigits parameter. The valid range for the fractionDigits parameter is from 0 to 20. Specifying a value outside this range throws an exception.

Parameters

fractionDigits:uint — An integer between 0 and 20, inclusive, that represents the desired number of decimal places. Returns
Throws RangeError — Throws an exception if the fractionDigits argument is outside the range 0 to 20.
Example  ( How to use this example )

The following example shows how

toFixed(3)

returns a string that rounds to three decimal places.


var num:Number = 7.31343;
trace(num.toFixed(3)); // 7.313


The following example shows how

toFixed(2)

returns a string that adds trailing zeroes.


var num:Number = 4;
trace(num.toFixed(2)); // 4.00
AS3 function toPrecision(precision:uint):String Language Version:  ActionScript 3.0 Runtime Versions:  Flash Player 9, AIR 1.0, Flash Lite 4

Returns a string representation of the number either in exponential notation or in fixed-point notation. The string will contain the number of digits specified in the precision parameter.

Parameters

precision:uint — An integer between 1 and 21, inclusive, that represents the desired number of digits to represent in the resulting string. Returns
Throws RangeError — Throws an exception if the precision argument is outside the range 1 to 21.
Example  ( How to use this example )

The following example shows how

toPrecision(3)

returns a string with only three digits. The string is in fixed-point notation because exponential notation is not required.


var num:Number = 31.570;
trace(num.toPrecision(3)); // 31.6


The following example shows how

toPrecision(3)

returns a string with only three digits. The string is in exponential notation because the resulting number does not contain enough digits for fixed-point notation.


var num:Number = 4000;
trace(num.toPrecision(3)); // 4.00e+3
AS3 function toString(radix:uint):String Language Version:  ActionScript 3.0 Runtime Versions:  AIR 1.0, Flash Player 9, Flash Lite 4

Returns the string representation of a uint object.

Parameters

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. Returns String — The string representation of the uint object.
Example
How to use this example

The following example uses 2 and 8 for the

radix

parameters and returns a string value with the corresponding representation of the number 9:

	 var myuint:uint = 9;
	 trace(myuint.toString(2)); // 1001
	 trace(myuint.toString(8)); // 11
	 

The 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); // 0xfa8072 
	 
AS3 function valueOf():uint Language Version:  ActionScript 3.0 Runtime Versions:  AIR 1.0, Flash Player 9, Flash Lite 4

Returns the primitive uint type value of the specified uint object.

Returns uint — The primitive uint type value of this uint object.
Example
How to use this example

The following example outputs the primitive value of the

numSocks

object.

	 var numSocks:uint = 2;
	 trace(numSocks.valueOf()); // 2
	 
public static const MAX_VALUE:uint = 4294967295 Language Version:  ActionScript 3.0 Runtime Versions:  AIR 1.0, Flash Player 9, Flash Lite 4

The largest representable 32-bit unsigned integer, which is 4,294,967,295.


Example
How to use this example

The following ActionScript displays the largest and smallest representable

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 Language Version:  ActionScript 3.0 Runtime Versions:  AIR 1.0, Flash Player 9, Flash Lite 4

The smallest representable unsigned integer, which is 0.


Example
How to use this example

The following ActionScript displays the largest and smallest representable

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
	 

The following example declares a uint

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);
            }
        }
    }
}

© 2015 Adobe Systems Incorporated. All rights reserved.
Thu Dec 6 2018, 01:12 PM -08:00

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4