Drupal connects to flash (AMFPHP)

I am trying to connect flash to drupal, and the following error is thrown:

Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.Failed

I believe the URL is correct so I don’t know what is goind wrong… help anyone?
Here is the code:


// Declare our baseURL and gateway
var baseURL:String = "http://localhost/drupal6";
var gateway:String = baseURL + "/services/amfphp";
// Declare our Drupal connection
var drupal:NetConnection = new NetConnection();
drupal.objectEncoding = ObjectEncoding.AMF3;
// Connect to the Drupal gateway
drupal.connect( gateway );
// Set up our responder with the callbacks.
var responder:Responder = new Responder( onConnect, onError);
// Connect to Drupal
drupal.call("system.connect", responder);
// Called when Drupal returns with a successful connection.
function onConnect( result:Object )
{
trace("We are connected!!!");
}
// Called when an error occurs connecting to Drupal.
function onError( error:Object )
{
for each (var item in error) {
trace(item);
}
}