all groups > macromedia flash flashcom > august 2007 >
You're in the

macromedia flash flashcom

group:

ActionScript 2.0 vs 3.0 NetConnection


ActionScript 2.0 vs 3.0 NetConnection cpowell1
8/30/2007 2:37:57 PM
macromedia flash flashcom: I have some code I've been using to connect to a streaming server. This version
is compiled for ActionScript 2.0:
----
netConnection = new NetConnection();
netConnection.onStatus = function(info) {
trace("status: " + info.code);
};
netConnection.connect("rtmp://server.net/blah/blah/");
----
When I run that, I get "status: NetConnection.Connect.Success" and everything
works like it should.


Now, I run what seems to me to be pretty much identical code, compiled for
ActionScript 3.0:
----
var netConnection:NetConnection = new NetConnection();
netConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
netConnection.connect("rtmp://server.net/blah/blah/");

function netStatusHandler(event:NetStatusEvent):void {
trace("status: " + event.info.code);
}
----
When I run that, though, I get:
status: NetConnection.Connect.Rejected
status: NetConnection.Connect.Closed

I've tried using port 1935 as suggested here, and that didn't help. I also
tried uploading this to my server to see if it was the firewall on my machine.
Same problem. I CAN connect using the FLVPlayBack control under ActionScript
3.0, but I'd rather use this method...

But honestly, the only real difference is the switch from AS2.0 to 3.0. What
could possibly be different to make the server reject my connection? Is there
some other way I'm supposed to connect with 3.0? I've found surprisingly little
info on the subject.

If it's something on the server itself, please explain slowly with small
words. :-) I know nothing about the server itself, don't have direct access to
it, and will have to be able to explain the problem to their admin.

Re: ActionScript 2.0 vs 3.0 NetConnection ramindeja
8/30/2007 6:07:11 PM
Try adding this code:

netConnection.objectEncoding = ObjectEncoding.AMF0;

Re: ActionScript 2.0 vs 3.0 NetConnection cpowell1
8/30/2007 6:31:03 PM
AddThis Social Bookmark Button