PHP Code:

```
// create some textfields
```

createTextField('playerText', getNextHighestDepth(), 100, 100, 100, 20);

playerText.text = 'Enter Player Name';

createTextField('player', getNextHighestDepth(), 100, 140, 100, 20);

player.border = true;

player.type = 'input';

createTextField('scoreText', getNextHighestDepth(), 100, 200, 100, 20);

scoreText.text = 'Enter Sample Score';

createTextField('score', getNextHighestDepth(), 100, 240, 100, 20);

score.border = true;

score.type = 'input';

createEmptyMovieClip('activator', getNextHighestDepth());

activator._x = 150; activator._y = 300;

activator.createTextField('activatorButton', activator.getNextHighestDepth(), 0, 0, 0, 0);

with(activator.activatorButton){ border = true; selectable = false; autoSize = 'center'; text = 'Press to Simulate'; }

createTextField('highScoreList', getNextHighestDepth(), 300, 50, 300, 450);

with(highScoreList){ border = wordWrap = multiline = true; }

// this string is a simulation of the string you will be receiving after sending your name/score to the server

updatedList = 'Adam,'+Math.round(Math.random() * 10000)+',Barry,'+Math.round(Math.random() * 10000)+',Charles,'+Math.round(Math.random() * 10000)+',Darren,'+Math.round(Math.random() * 10000)+',Ernest,'+Math.round(Math.random() * 10000)+',Frank,'+Math.round(Math.random() * 10000)+',George,'+Math.round(Math.random() * 10000)+',Arianna,'+Math.round(Math.random() * 10000)+',Brittany,'+Math.round(Math.random() * 10000)+',Christine,'+Math.round(Math.random() * 10000)+',Dorothy,'+Math.round(Math.random() * 10000)+',Elizabeth,'+Math.round(Math.random() * 10000)+',Francine,'+Math.round(Math.random() * 10000)+',Gretchen,'+Math.round(Math.random() * 10000);

// this would be in an onLoad or onData type of function

activator.onPress = function(){

// split it up at the commas

splitList = updatedList.split(',');

// seed your score list with the name/score pairs as properties of an object in an array

scoreList = new Array();

for(var l = 0; l < splitList.length; l += 2){

scoreList.push( { name: splitList[l], score: Number(splitList[l + 1]) } );

}

// this next line is just for this simulation, it will be handled by the backend script in your app

scoreList.push( { name: player.text, score: Number(score.text) } );

// sort by numeric scores in descending order

scoreList.sortOn('score', Array.NUMERIC | Array.DESCENDING);

// display the highscore list

for(var i = 0; i < scoreList.length; i++){

highScoreList.text += scoreList[i].name + ' ' + scoreList[i].score + '

';

}

};