http://vkontakte.ru/source/Tetris.zip
Код: Выделить всё
function TetrisHighScores(){
if (!sLevel.pflag && sLevel.Blocks != undefined && !sLevel.ToStop)
TetrisPause();
sHighScores.gotoAndStop("Loading");
var self:Object = this;
dataProvider.getUsersRating(function(success:Boolean){ // limit == 10
self.sHighScores.gotoAndStop("HighScores");
if (success) {
trace(this);
var txtUserNames:TextField = self.sHighScores.txtUserNames;
var txtScores:TextField = self.sHighScores.txtScores;
txtUserNames.styleSheet = self.style_sheet;
txtScores.styleSheet = self.style_sheet;
var scores:Array = new Array();
for (var fNode:XMLNode = this.firstChild.firstChild; fNode != null; fNode = fNode.nextSibling) {
var user_id: String;
var user_name: String;
var score: Number;
for (var cNode:XMLNode = fNode.firstChild; cNode != null; cNode = cNode.nextSibling) {
switch (cNode.nodeName){
case 'user_id': user_id = cNode.firstChild.nodeValue; break;
case 'user_name': user_name = cNode.firstChild.nodeValue; break;
case 'score': score = parseInt(cNode.firstChild.nodeValue); break;
}
}
scores.push({user_id: user_id, user_name: user_name, score: score});
}
txtUserNames.htmlText = txtScores.htmlText = "";
for (var i:Number = 0; i < scores.length; i++)
{
txtUserNames.htmlText += "<p>" + (i+1) + '. <a href="http://vkontakte.ru/id' + scores[i]['user_id'] + '" target="_blank">' + scores[i]['user_name'].substr(0, 25) + '</a></p>';
txtScores.htmlText += "<p>" + scores[i]['score'] + "</p>";
}
} else {
self.sHighScores.txtUserNames.htmlText = "Connection failed.";
}
});
}