Convirtiendo number a string as3

Bueno en este ejemplo de as3 mostrare la manera de convertir x tipo de variable en otra como ser

int a float(doble)                                    
int a string

                                           float a int

string a float
string a int


las variables de tipo string son las de texto

las variables de tipo int son enteros


aqui el codigo



//creando variables as3
var entero:int;
var numero:Number;
var texto:String;
entero=5;
numero=99.99;

//convert int y number a texto as3
entero=5;
numero=99.99;
texto="Entero: "+String(entero)+" Numero: "+String(numero);
trace("texto: ",texto);

//int y texto a number as3 
numero=Number(entero)/4;
trace("numero: ",numero);
texto="9";
numero=Number(texto)+0.99;
trace("numero: ",numero);

//text y number a int as3
texto="1";
numero=4.99;
entero=int(texto)+int(numero);
trace("entero: ",entero);






Descargar Ejemplo:

                                                           AS3

Comentarios

Populares

Buscar en este blog