flex + FMS入门____链接FMS

本文介绍了一个使用Flex创建的应用实例,该应用能够连接到Flash Media Server (FMS) 服务器。通过NetConnection组件实现了与FMS服务器的连接,并通过事件监听来确认连接状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="
http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
 <s:layout>
  <s:BasicLayout/>
 </s:layout>
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <s:Panel x="346" y="27" width="292" height="176" id="call" title="呼叫中。。。">
  <s:Button x="110" y="70" label="链接" id="linkfms" click="ConnFMS()"/>
  <s:Label x="93" y="40" text="标签" id="linkinfo"/>
 </s:Panel>
 <fx:Script source="test/linkFMS.as">  
 </fx:Script>
</s:Application>

 

import flash.net.NetConnection;
import flash.net.NetStream;
import flash.display.MovieClip;
import flash.net.Responder;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
import flash.events.AsyncErrorEvent;

private var nc:NetConnection;        
public function ConnFMS()

 linkinfo.text="正在连接....";
 nc = new NetConnection();
 nc.connect("rtmp://localhost/talk");
 nc.addEventListener(NetStatusEvent.NET_STATUS,onNetStatusHandler);
}

private function onNetStatusHandler(evt:NetStatusEvent):void
{
 if(evt.info.code=="NetConnection.Connect.Successl")
 {
   linkinfo.text="成功连接FMS服务器!";
 }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值