Skip to main content
October 23, 2006
Question

How to know is connection Successes or not?

  • October 23, 2006
  • 1 reply
  • 199 views
Hi All,

I'm new to MediaServer and I just cound not found any code that confirms that connection to media server is successfuly created or not?

Do any one have any code snippetl regardin this..

I'll be thankful\

Amitpal
    This topic has been closed for replies.

    1 reply

    October 23, 2006
    attach onStatus method to your NetConnection object:


    var objNetCon:NetConnection;
    var strFMSAdd:String;

    strFMSAdd = "rtmp://xxx.xxx.xxx.xxx/yourAppName/yourInstanceName";
    objNetCon = new NetConnection();

    // here's the part that interest you
    // objInfo : Object return by FMS
    objNetCon.onStatus = function(objInfo){
    if(objInfo.code == "NetConnection.Connect.Success"){
    trace("you are now connected")
    // your code
    } else {
    // it's best to look for "NetConnection.Connect.Rejected"
    trace("connection error:" + objInfo.code)

    // for custom message
    //trace("connection error:" + objInfo.application.message)
    }
    }

    // connecting to FMS
    // you can pass extra parameters
    objNetCon.connect(strFMSAdd);