non so che tecnologia server side hai a disposizione ... qualora fosse php ...
contatore.php
codice:
<?php
function addVictory($contatore, $maxvictory) {
$total = file_exists($contatore) ? (int)file_get_contents($contatore) : 0;
if($total < $maxvictory && @$fp = fopen($contatore, "w")) {
fwrite($fp, ++$total);
fclose($fp);
}
return $total;
}
// qui dovresti mettere un controllo di qualche tipo
// altrimenti basta refreshare 10 volte che il quiz termina
echo '&total='.addVictory('file_contatore.txt', 10);
?>
flash.fla
codice:
contatore = new LoadVars();
contatore.onLoad = function(s) {
if(s && Number(this['total']) < 10) {
trace('Ok, puoi giocare ... per ora');
}
else {
trace('Spiacente, tutti i premi sono stati assegnati');
}
}
contatore.load('http://localhost/contatore.php');
// ... alla fine del quiz ...
contatore.onLoad = function(s) {
if(s && Number(this['total']) < 10) {
trace('HAI VINTO!!!');
}
else {
trace('Spiacente, i premi sono terminati mentre giocavi, sfigato.');
}
}
contatore.load('http://localhost/contatore.php');