tags:

views:

133

answers:

1

Hey guys ,

I want to count the online user,when each client login the system,it's connecting to the server and increase a variable stored in a remote shared object.

But when client connecting server,problems arises:Error #2126: NetConnection object must be connected

My web layout:

Website --- apps --- userLogin

Code snippets:

rtmpnc = new NetConnection();
 rtmpnc.objectEncoding = ObjectEncoding.AMF0;
 var uri:String = ServerConfig.getChannel("my-rtmp").endpoint + "/userLogin";
 rtmpnc.connect("http://202.206.249.193:2367/userLogin");
                rtmpnc.addEventListener(NetStatusEvent.NET_STATUS,onNetStatusHandler);

The onNetStatusHander is defined as :

switch(event.info.code)
   {
       case "NetConnection.Connect.Success":onConnSuccess();break;
       case "NetConnection.Connect.Failed":onConnError();break;
   }

Could anyoue help me out?Much thanks!

Best,Shuo

A: 

Move the eventListener to the line above the connect() (just in case). Also add a SecurityErrorEvent.SECURITY_ERROR eventListener before your connect. I'm going to guess we're looking at a security sandbox problem.

jeremy.mooer