I am working on taking a Flash game developed by a Flash freelancer and having it save answers to Drupal. The freelancer used ActionScript 2 so the examples in the Flash with Drupal book don't work. He also used Flash CS5, so I had to manually download and add the mx.rpc classes.
I was able to get it to work previously, but around the beginning of March it stopped working. I don't believe I changed any configuration settings in Services (I'm not using any kind of authentication currently) and this happens with User 1 so I've been able to rule out permissions.
Just to rule out any changes I made, I create a basic connection script script that should just tell me if system.connect() worked. The code is below.
import mx.remoting.Service;
import mx.services.Log;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.debug.NetDebug;
NetDebug.initialize();
// initialize the Logger
var myLogger:Log = new Log(Log.DEBUG, "logger1");
// override the default log handler
myLogger.onLog = function(message:String):Void
{
trace("myLogger-->>>" + message);
};
// Remoting
trace("Start");
var gate:String = "http://localhost:62229/services/amfphp";
var rp:RelayResponder = new RelayResponder(this, "onResult", "onFault");
var conn:Service = new Service(gate, myLogger, "system", null, rp);
var spc:PendingCall = conn.connect();
function onResult(c:ResultEvent)
{
mx.remoting.debug.NetDebug.trace({level:"Debug", message:"Success!"});
trace("Connected");
var sessid = c.result.sessid;
trace(sessid);
}
function onFault(fe:FaultEvent):Void
{
mx.remoting.debug.NetDebug.trace({level:"None", message:"There was a problem: " + fault.fault.faultstring});
}
trace("End");
When I use the debugger and step through the code, I step through the classes for the PendingCall class but no RelayResponder is ever called and the IsConnected property for __conn is always false. I do get a trace event saying that the service was successfully created and then another trace event saying system.connect() was invoked.
Is my code wrong? Did the newest Flash Player deprecate/stop supporting AS2 remoting? is my scoping off?
Any help would be much appreciated as I've been going over this for a week and a half on my own.
Thanks!
James
Comments
Working
I'm not sure why, but I was able to start connecting again.
Then, I had issues with data not saving and tracked this down to an issue with some Rules where I had custom PHP code.
Resolved :)
James
--James