Foros del Web » Creando para Internet » Flash y Actionscript »

Ordenar Letras Y Numeros De Mayor A Menor

Estas en el tema de Ordenar Letras Y Numeros De Mayor A Menor en el foro de Flash y Actionscript en Foros del Web. Hola necesito ayuda con un code, y espero lo puedan revisar. El usuario tiene que introducir su nombre y Edad para posteriormente almacenar lo cual ...
  #1 (permalink)  
Antiguo 19/12/2007, 11:45
 
Fecha de Ingreso: diciembre-2006
Ubicación: Mexico
Mensajes: 8
Antigüedad: 17 años, 3 meses
Puntos: 0
Ordenar Letras Y Numeros De Mayor A Menor

Hola necesito ayuda con un code, y espero lo puedan revisar. El usuario tiene que introducir su nombre y Edad para posteriormente almacenar lo cual ya hace…

LO QUE NECESITO ES QUE ME LOS ORDENE DE MAYOR A MENOR CUANDO SE GUARDEN.

De antemano un saludo, GRACIAS!!!

Código:
 function appendSharedObj() 
{ 
   arr.push({name: nameTxt.text, age: ageTxt.text}); 
   ++count; 
} // End of the function 
function writeData() 
{ 
   var _loc2 = arr.length; 
   if (_loc2 > 5) 
   { 
       _loc2 = 5; 
       arr.shift(); 
   } // end if 
   for (var _loc1 = _loc2 - 1; _loc1 >= 0; --_loc1) 
   { 
       nameTxt.text = nameTxt.text + arr[_loc1].name + "\n"; 
       ageTxt.text = ageTxt.text + arr[_loc1].age + "\n"; 
   } // end of for 
   totalEntries.text = count; 
   if (information == "") 
   { 
       information = "You are the first to visit this application"; 
   } 
   else 
   { 
       information = "You have visited this application before"; 
   } // end else if 
   info.text = information; 
} // End of the function 
function writeToShared() 
{ 
   mySO.data.arr = arr; 
   mySO.data.count = count; 
   mySO.data.info = information; 
   mySO.flush(); 
} // End of the function 
fscommand2("Fullscreen", true); 
fscommand2("SetSoftKeys", "menu", "back"); 
var mySO = SharedObject.getLocal("dataTypes"); 
var keyList = new Object(); 
var arr = new Array(); 
var count = 0; 
var information = ""; 
soInitHandler = function (so) 
{ 
   if (so.getSize() > 0) 
   { 
       arr = so.data.arr; 
       count = so.data.count; 
       information = so.data.info; 
   } // end if 
}; 
SharedObject.addListener("dataTypes", soInitHandler); 
keyList.onKeyDown = function () 
{ 
   var _loc1 = Key.getCode(); 
   if (_loc1 == ExtendedKey.SOFT1) 
   { 
       if (nameTxt.text == "" || ageTxt.text == "") 
       { 
           alert.text = "Information incomplete"; 
       } 
       else 
       { 
           appendSharedObj(); 
           gotoAndStop("display"); 
       } // end else if 
   } 
   else if (_loc1 == ExtendedKey.SOFT2) 
   { 
       fscommand2("ResetSoftKeys"); 
       fscommand2("Quit"); 
   } // end else if 
}; 
Key.addListener(keyList); 
SharedObject.addListener("dataTypes", soInitHandler);  
  #2 (permalink)  
Antiguo 20/12/2007, 08:22
 
Fecha de Ingreso: junio-2006
Mensajes: 270
Antigüedad: 17 años, 9 meses
Puntos: 0
Re: Ordenar Letras Y Numeros De Mayor A Menor

arr.sortOn("name");
Ya para hacer una ordenacion para los que tengan el mismo "name", solo se me ocurre currarte un metodo.
Salu2
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:01.