Skip to main content
October 15, 2013
Question

Runtime argument error issues

  • October 15, 2013
  • 0 replies
  • 364 views

Hello All, I am having some connection issues with the NetStream and NetConnection classes in my application.

I am trying to connect to my webcam via Adobe Media Server so I can publish audio, video and other forms of data to Flash Media Server. Before I run my application I listen for the statusevent and its work fine!

However, when I attempt to publish I get this error in the output:

ArgumentError: Error #2126: NetConnection object must be connected.
        at flash
.net::NetStream/ctor()
        at flash
.net::NetStream()

I have everything setup:

var nc:NetConnection = new NetConnection();

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

nc.connect("rtmfp://localhost/streamCam"); and I try localhost for rtmfp

var ns:NetStream = new NetStream(nc);

ns.publish("myStream", "live");

ns.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

function netStatus(event:NetStausEvent):void{

switch(event.info.code){

case "NetConnection.Connect.Success":

trace("Connecting up");

break;

case "NetConnection.Connect.Failed":

trace("Unable to connect to FMS");

break;

case "NetConnection.Connect.Rejected":

trace("Whooops");

break;

I don't know where the problem is. Can anyone shed any light on this?

    This topic has been closed for replies.