2007-06-10

AS3 與 AMFPHP 1.2 part 3 - Credentials

AS3 沒有 setCredentials() 了
而是利用 NetConnection.addHeader(), 下兩行是 Help 裡說明
Adds a context header to the AMF packet structure.
This header is sent with every future AMF packet.

Flash AS3:
var nc:NetConnection = new NetConnection();
nc.objectEncoding = ObjectEncoding.AMF0;
nc.connect('http://localhost/amfphp/gateway.php');
nc.addHeader("Credentials", false,
{userid:'kitty', password:'kitty'});

var responder:Responder = new Responder(onResult, onError);
nc.call('myremoting.DataOp_6.isLogin', responder);

function onResult(re:Object):void {
QopDump.echo(re);
}
function onError(er:Object):void {
QopDump.echo(er);
}

沒有留言:

FB 留言