Comunidad de diseño web y desarrollo en internet online

problemas con numeros en action script 3

Citar            
MensajeEscrito el 29 Jul 2010 05:33 am
estimados necesito hacer lo siguiente necesito convertir un numero a string pero de la siguiente manera
si el numero es 9 q lo convierta a string como 09 como hago eso ahy alguna funcion o tengo q yo hacerlo a mano?
saludos

Por anikilatorbeta

42 de clabLevel



 

chrome
Citar            
MensajeEscrito el 29 Jul 2010 07:49 pm
hola anikilator

podrias utilizar esta funcion.

Código ActionScript :

trace(convertirNumero(10));

function convertirNumero(numero:int):String{
   if(numero<10){
      return("0"+String(numero))
   }else{
      return(String(numero));
   }
}


basicamente le digo que si el numero es menor de 10 le agrege el 0, y que lo retorne como string

Por fats2005

6 de clabLevel



 

Ingeniero en Multimedia

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.