Hello,
I have a Flash movie that calls up a PHP file that throws a dice and returns results (rolls and the user who rolled). All variables are read, they are being loaded normally, but I have one problem. One of the variables (the roll string) is passed to flash without the number characters. Instead of showing “Joe rolled 7|8|4|2|3” it shows “Joe rolled ||||”. No, it’s not the embedding, they’re not showing in trace window…
[EDIT] Just checked using letters and it doesn’t work either. No matter what is the value of $diceroll it won’t show up in Flash (it echoes normally, though, in the browser when I run the PHP). Also, the ‘,’ doesn’t show too.
Here’s the ActionScript:
function getVars(file) {
var variables = new LoadVars();
variables.onData = function(src){
trace(src);
variables.decode(src)
if (variables.error){
trace(variables.error);
} else {
trace(variables.user + ' rolled ' + variables.roll);
}
}
variables.load(file);
}
And here’s the PHP code:
for ($a = 0; $a < $total; $a++){
$diceroll = rand(1, $sides);
$roll .= $diceroll;
while ($diceroll >= $exploder):
$diceroll = rand(1, $sides);
$roll .= ','.$diceroll;
endwhile;
if ($a != $total - 1) $roll .= '|';
}
echo '&roll='.$roll.'&user='.$user;
Anyone ever seen this happen?