Es lo primero que probé, pero así no funciona, supongo que porque no puede entender los Strings como nombres de tabla...
Pongo todo el código por si acaso (una burda copia de tu tutorial

)
Código :
<?php
class Records{
var $maxItem;
function Records(){
$this->maxItem=5;
$this->methodTable = array(
"init" => array(
"description"=>"pasa las variables iniciales y devuelve toda la tabla",
"access"=>"remote",
"arguments"=>array("table","maxItems")
),
"add" => array (
"description"=>"añade una puntuacion",
"access"=>"remote",
"arguments"=>array("nombre","puntos")
),
"show" => array (
"description"=>"muestra las primeras n puntuaciones",
"access"=>"remote",
"arguments"=>array("n")
),
"query"=>array(
"description"=>"ejecuta un query a MYSQL",
"access"=>"private",
"arguments"=>array("sql","accion")
),
);
}
function init($table,$maxItems){
//$maxItem=&$maxItems;
$sql="SELECT name,points,date FROM $table ORDER BY points DESC LIMIT ".$maxItems."";
$this->maxItem=45;
return $this->query($sql,0);
}
function add ($nombre,$puntos){
$nombre= utf8_encode($nombre);
$fecha= utf8_encode($fecha);
$sql="INSERT INTO game1 (id,name,points,date) VALUES ('','".$nombre."','".$puntos."',NOW())";
//return $this->query($sql,1);
return $this->maxItem;
}
function show ($n){
$sql="SELECT name,points,date FROM game1 ORDER BY points DESC LIMIT ".$n."";
return $this->query($sql,0);
}
function query($sql,$accion){
$conex=mysql_connect("localhost","root") or die ("no se puede conectar: ".mysql_error());
mysql_select_db("recordsdb");
$result=mysql_query($sql,$conex);
if($accion && result){
$result=mysql_insert_id();
}
mysql_close($conex);
return $result;
}
}
?>
Y en AS:
Código :
import mx.remoting.NetServices;
import mx.remoting.Connection;
mx.remoting.debug.NetDebug.initialize();
NetServices.setDefaultGatewayUrl("http://localhost/remoting/gateway.php");
conexion = NetServices.createGatewayConnection();
capturaRespuesta = new Object();
servicio = conexion.getService("Records", capturaRespuesta);
capturaRespuesta.onStatus = function(data) {
trace("Fuck un error, por:"+data.description);
};
capturaRespuesta.init_Result = function(data) {
a = 50;
var proveedor:Array = new Array();
if (data) {
if (data.getLength()) {
//trace(data.getLength());
for (i=0; i<data.getLength(); i++) {
proveedor.addItem({nombre:unescape(data.getItemAt(i).name), puntuacion:data.getItemAt(i).points, fecha:unescape(data.getItemAt(i).date)});
}
datagrid.dataProvider = proveedor;
//trace(datagrid.dataProvider);
datagrid.getColumnAt(0).widatah = 100;
datagrid.getColumnAt(1).widatah = 50;
datagrid.getColumnAt(2).widatah = 75;
datagrid.selectedIndex = 0;
}
}
};
capturaRespuesta.add_Result = function(data) {
trace(a);
trace(data);
};
bt.onRelease = function() {
servicio.add("zah", random(200));
servicio.init("game1", 10);
};
//servicio.show(1);
servicio.init("game1", 10);