Groups | Blog | Home
all groups > macromedia flash flashcom > october 2006 >

macromedia flash flashcom : How to know is connection Successes or not?


Sonu Dhiman
10/23/2006 4:23:59 PM
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:brokenheart;
anonymous thing
10/23/2006 5:38:58 PM
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);
AddThis Social Bookmark Button