P.S.
  本连接器代码是可支持Flashcom多端口(1935,443,80),多协议(rtmp,rtmps,rtmpt)扫描.

以下是Connector.as代码片段:
//======================================;
// Name:Connector.as
// Auther:Kinglong
// Email:kinglong@gmail.com
// Date:2005-06-29
// Desc:FCS连接器;
//=======================================;
import mx.events.EventDispatcher;
//=======================================;
class com.klstudio.fcs.Connector extends Object{
 //======================================;
 private var dispatchEvent:Function; 
 public var addEventListener:Function; 
 public var removeEventListener:Function;
 public var target:Object;
 public var index:Number;
 //======================================;
 private var __connectListArray:Array;
 private var __host_name:String;
 private var __app_name:String;
 private var __connected:Boolean;
 private var __connect_list_point:Number;
 private var __connection_num:Number;
 private var __connection_max_num:Number;
 private var __connection:NetConnection;
 private var __connection_params:Object;
 //=======================================;
 private var __mar_next_connect:Number;
 private var __mar_all_failed_connect:Number;
 //=======================================;
 function Connector(host:String,app:String){
  if(arguments.length>1){
   this.__host_name = host;
   this.__app_name = app;
  }
  this.initConnector();
 }
 //========================================;
 // 初始化对象;
 //========================================;
 private function initConnector():Void{
  //=======================================;
  EventDispatcher.initialize(this);
  //=======================================; 
  this.__connected = false;
  this.__connection_num = 0;
  this.__connection_max_num = 3;
  this.__connection = null;
  this.__connection_params = null;
  //=======================================;
  this.__connectListArray = new Array();
  this.__connectListArray.push({protocol: "rtmp", port: 1935});
  this.__connectListArray.push({protocol: "rtmp", port: 443});
  this.__connectListArray.push({protocol: "rtmpt", port: 80});
  this.__connectListArray.push({protocol: "rtmps", port: 443});
  //=======================================;  
 }
 //========================================;
 // 启动连接表;
 //========================================;
 private function doActualConnect():Void{
  this.removeAllTimeOut();
  this.__connection_num ++;
  if(this.__connection_num > this.__connection_max_num){
   this.myTrace("总共尝试"+this.__connection_max_num+"次 都失败!");
   this.dispatchEvent({type:"failed",data:"服务器连接失败!"});
   return;
  }
  this.__connect_list_point = 0;
  var i:Number;
  for(i=0;i<this.__connectListArray.length;i++){
   this["temp_nc_"+i] = new NetConnection();
   this["temp_nc_"+i].index = i;
   this["temp_nc_"+i].target = this;
   this["temp_nc_"+i].onStatus = this.doStatus;
  }
  var connection_uri:String = this.__connectListArray[this.__connect_list_point].protocol+"://"+this.__host_name+":"+this.__connectListArray[this.__connect_list_point].port+"/"+this.__app_name;
  this.myTrace("[尝试"+this.__connection_num+"/"+this.__connection_max_num+"]连接到 "+(this.__connect_list_point+1)+"/"+this.__connectListArray.length+": "+connection_uri);
  this.dispatchEvent({type:"connect",data:this.__connectListArray[this.__connect_list_point]});
  this["temp_nc_"+this.__connect_list_point].connect(connection_uri,this.__connection_params);
  this.__mar_next_connect = setInterval(this,"nextConnect",3000);
 }
 //========================================;
 // 下一个连接;
 //========================================;
 private function nextConnect():Void{
  clearInterval(this.__mar_next_connect);
  this.__connect_list_point ++;
  if(this.__connect_list_point<this.__connectListArray.length){  
   var connection_uri:String = this.__connectListArray[this.__connect_list_point].protocol+"://"+this.__host_name+":"+this.__connectListArray[this.__connect_list_point].port+"/"+this.__app_name;
   this.myTrace("[尝试"+this.__connection_num+"/"+this.__connection_max_num+"]连接到 "+(this.__connect_list_point+1)+"/"+this.__connectListArray.length+": "+connection_uri);
   this.dispatchEvent({type:"connect",data:this.__connectListArray[this.__connect_list_point]});
   this["temp_nc_"+this.__connect_list_point].connect(connection_uri,this.__connection_params);
   this.__mar_next_connect = setInterval(this,"nextConnect",3000);
  }
 }
 //=========================================;
 // 下一个连接;
 //=========================================;
 private function allFailedConnect():Void{
  clearInterval(this.__mar_all_failed_connect);
  this.doActualConnect();
 }
 //=========================================;
 // 取消所有线程;
 //=========================================;
 private function removeAllTimeOut(ncIndex:Number):Void{
  if(arguments.length == 0){
   ncIndex = -1;
  }
  clearInterval(this.__mar_next_connect);
  clearInterval(this.__mar_all_failed_connect);
  var i:Number;
  for(i=0;i<this.__connectListArray.length;i++){
   if(i == ncIndex){
    this.myTrace(this.__connectListArray[ncIndex].protocol+"://"+this.__host_name+":"+this.__connectListArray[ncIndex].port+"/"+this.__app_name+" 连接尝试成功!");
   }else{
    this["temp_nc_"+i].close();
    delete this["temp_nc_"+i];
   }
  }
 }
 //=========================================;
 private function doStatus(ncInfo:Object):Void{
  this.target.onStatus(this.index,ncInfo);
 }
 //=========================================;
 private function onStatus(ncIndex:Number,ncInfo:Object):Void{
  switch(ncInfo.code){
   case "NetConnection.Connect.Success":
    this.removeAllTimeOut(ncIndex);
    this.__connection = this["temp_nc_"+ncIndex];
    this.__connected = true;
    this.dispatchEvent({type:"success"});    
   break;
   case "NetConnection.Connect.Failed":
    this.myTrace(this.__connectListArray[ncIndex].protocol+"://"+this.__host_name+":"+this.__connectListArray[ncIndex].port+"/"+this.__app_name+" 连接尝试失败!");
    if(ncIndex==this.__connectListArray.length-1){
     this.myTrace("所有连接尝试失败!");
     this.removeAllTimeOut();
     this.__mar_all_failed_connect = setInterval(this,"allFailedConnect",5000);
    }
   break;
   case "NetConnection.Connect.Closed":
   case "NetConnection.Connect.AppShutdown":
    this.dispatchEvent({type:"closed"});
   break;
   case "NetConnection.Connect.Rejected":
    this.removeAllTimeOut();
    this.myTrace("FlashCom服务器不接收连接尝试!");
    this.dispatchEvent({type:"failed",data:ncInfo.application.message});
   break;
  }  
 }
 //=========================================;
 // 调试;
 //=========================================;
 private function myTrace(msg:Object):Void{
  trace("#Connector#: "+msg);
  getURL("FSCommand:log", "#Connector#: "+msg);
 }
 //=========================================;
 // 设置连接参数;
 //=========================================;
 public function setConnectParams(param:Object):Void{
  this.__connection_params = param;
 }
 //=========================================;
 // 设置连接表;
 //=========================================;
 public function setConnectListArray(arr:Array):Void{
  this.__connectListArray = arr;
 }
 //=========================================;
 // 设置最大尝试连接资料;
 //=========================================;
 public function setConnectMaxNum(num:Number):Void{
  if(num>1 && num <11){
   this.__connection_max_num = num;
  }
 }
 //=========================================;
 // 连接FCS服务器;
 //=========================================;
 public function connect():Void{
  if(this.__connected) return;
  this.__connection_num = 0;
  this.doActualConnect();
 }
 //=========================================;
 // 检查是否连接成功;
 //=========================================;
 public function isConnected():Boolean{
  return this.__connected; 
 }
 //=========================================;
 // 获取主连接NC;
 //=========================================;
 public function getConnection():NetConnection{
  return this.__connection; 
 } 
}
  
 不过本类也不是我首创,我也是在Breeze云开写的代码基础上优化而来的!