Gabz wrote:
Hi!

This code is in AS2.0, this works with Red5:

    nc = new NetConnection();
    nc.connect("rtmp://localhost/demo");
    nc. {
        trace("The result is " + obj);
   }
   nc.call("add", nc, 1, 2);

This is in AS3.0:

var nc = new NetConnection();
var resp:Responder = new Responder(onResult,null);
nc.connect("rtmp://localhost/demo");
nc.call("add", resp, 1, 2);  

function onResult(obj:Object):void {
        trace("The result is "+obj);
 }


I'm always getting: "Unhandled NetStatusEvent:. level=error, 
code=NetConnection.Connect.Failed"

Please help, thank you in advance: Gabor

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

  
you have to set the default object encoding to AMF0, here is a helper subclass which works fine for me.

public class Connect extends NetConnection
    {
        private var code:String;
        private var _autoBandwidthDetection:Boolean = false;
       
        public function Connect(encodeAMF0:Boolean = true)
        {
            setDefaultEncoding(encodeAMF0);
            super();
        }

        private function setDefaultEncoding(encodeAMF0:Boolean = true):void
        {
            if (encodeAMF0)
            {
                this.objectEncoding = flash.net.ObjectEncoding.AMF0;
            } else {
                this.objectEncoding = flash.net.ObjectEncoding.DEFAULT;
            }
        }
     
       
    }
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to