首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

Flex 连接FMS解决方法

2012-03-09 
Flex 连接FMSFlex 4.5FMS4.5安装完成之后,想播放下FMS application目录下vod中的 sample.flv(具体路径为Fl

Flex 连接FMS
Flex 4.5
FMS4.5
安装完成之后,想播放下FMS application目录下vod中的 sample.flv(具体路径为Flash Media Server 4.5\applications\vod\media\sample.flv)
怎么都播放不了,是不是少了哪步设置?

XML code
    <fx:Script>        <![CDATA[            import mx.controls.Alert;                        private var nc:NetConnection;            private var ns:NetStream;                        protected function button1_clickHandler(event:MouseEvent):void            {                nc = new NetConnection();                nc.addEventListener(NetStatusEvent.NET_STATUS,netStatus);                nc.connect("rtmp://localhost:1935/vod");            }                        private function netStatus(e:NetStatusEvent):void            {                Alert.show(e.info.code);                if(e.info.code == "NetConnection.Connect.Success")                {//                    Alert.show("Net Success!");                    ns = new NetStream(nc);                    ns.play("sample.flv");                    var video:Video = new Video();                    video.attachNetStream(ns);                    videoDis.addChild(video);                }            }                        protected function button2_clickHandler(event:MouseEvent):void            {                this.videoDis.source = "rtmp://localhost:1935/vod/media/sample.flv";            }                    ]]>    </fx:Script>        <s:VideoDisplay id="videoDis" x="10" y="10" width="380" height="241" autoPlay="true"/>    <s:Button x="23" y="259" label="获取" click="button1_clickHandler(event)"/>    <s:Button x="121" y="259" label="按钮" click="button2_clickHandler(event)"/>


[解决办法]
这样写: ns.play("sample");

热点排行