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