FMS简单交互实例

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFEEE"
    creationComplete="init()">
 
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import mx.formatters.DateFormatter;
   private var srvurl:String = "rtmp://localhost/flex";
   private var nc:NetConnection;
   private var responder:Responder;
   private var inst:String;
   private var outst:String;
   private var mystring:String
   
   private function init():void
   {
    inst = "ml";
    outst = "mj";
    nc = new NetConnection();
    nc.connect(srvurl);
    nc.client = this;        //指示应对其调用回调方法的对象, 设置为this后, Server端call的就是this中定义的方法
    nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
   }
   
   private function onNetStatus(event:NetStatusEvent):void
   {
    nc.call("MSGChange",null,inst+outst);
    Alert.show("视频请求已发出请等待。。。。");   
             
     
   public function MSGChange(obj:Object):String
   {
    Alert.show(obj.toString());
    mystring = obj.toString();
    var a = mystring.indexOf("mj");

    if(a){
     Alert.show(mystring);    
    }
    //lblSrvNotice.text = obj.toString();
    return "I just want to begin";
   }
   
   
  ]]>
 </mx:Script>
</mx:Application>

asc文件如下:

application.onAppStart = function()
{
};

application.onConnect=function(newClient){
trace("hhhhhhh");

application.acceptConnection(newClient);

}

Client.prototype.MSGChange=function(msg){
application.broadcastMsg("MSGChange",msg);
}
 
application.onDisconnect = function(currentClient)
{
 //When currentClient leaves put the element back in array
 //vidStreams.push(currentClient.cliNow);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值