Abdulcode

Pages

Jul 21, 2010

Number to String Conversion

Syntax:
toString(radix);

radix Specifies the numeric base (from 2 to 36) to use for the number-to-string conversion.
Sample:
package
{
import flash.display.Sprite;

public class Sample_AS extends Sprite
{
public function Sample_AS()
{
var num:int = 241;

trace(num.toString(2)); // Binary
trace(num.toString(8)); // Octal
trace(num.toString(16)); // Hexadecimal
}
}
}

No comments:

Post a Comment