Flex 2 and AMFPHP

Posted on December 11, 2005 | 1 comment

When I connect Flex 2 and AMFPHP using the code below I get a “ReferenceError: Error #1069: Property AppendToGatewayUrl not found on flash.net.NetConnection and there is no default value”.

AS3 code:

var gatewayUrl : String = "http://localhost/amfphp/gateway.php";
gateway_conn = new NetConnection();
gateway_conn.objectEncoding = flash.net.ObjectEncoding.AMF0;
gateway_conn.connect( gatewayUrl );
gateway_conn.call( "com.multispan.micro.Person.getPersons", new flash.net.Responder( onQueryResult, onQueryStatus ) );

I am using the latest AMFPHP stable build (AMFPHP 1.0 MS3).

Search for AppendToGatewayUrl in the amfphp files I see that AuthenticationFilter.php has a line where its added to the header of the AMF message. When I comment out the 2 lines of code the “AppendToGatewayUrl” error goes away.

//$outHeader = new AMFHeader(“AppendToGatewayUrl”, false, “?” . ini_get(‘session.name’) . “=” . $session_id);
//$localRef->addOutgoingHeader($outHeader);

I would like to understand what the “new AMFHeader(“AppendToGatewayUrl”, false, “?” . ini_get(‘session.name’) . “=” . $session_id);” does. Is it only for passing the sessionid through? any thoughts are other comments are welcome.

[update] AppendToGatewayUrl is used to take the PHP Session id and append it to the gateway url for use in your code. Not sure why it broke with Flex2, could be the new AMF format or the new flash.net.NetConnection class. I do not particular need PHP Session id’s as of yet so I will live with it turned off in AMFPHP.

  • http://Responder Pete

    You’d need to subclass flash.net.Responder and provide an implementation of a method with the name that matches the AMF Header.

    For example:

    public function AppendToGatewayUrl(append:String):Void
    {
    // Modify the NetConnection URL with this info
    }

  • Pingback: Renaun Erickson’s Blog » Flax2 and AMFPHP 1.2 (revisited)