[AS3]AS3.0与Red5之间的参数传递(rtmp流媒体)
[AS3]AS3.0与Red5之间的参数传递(rtmp流媒体)差不大一年没去动red5了,现在因为项目需要又开始使用red5,呵呵,先写些基本应用吧参数传递是最基本的,之前是as2,现在用as3与red5 0.63了,几乎没什么变化
差不大一年没去动red5了,现在因为项目需要又开始使用red5,呵呵,先写些基本应用吧
参数传递是最基本的,之前是as2,现在用as3与red5 0.63了,几乎没什么变化.不过flash这边的可以传递的参数也就多了一些.就基本的是
String,int,Number,Boolean,Array,对应到red5这边是String,int,double,boolean,List
下面看基本的代码吧(Flash:):
- /**
- * @(#)ParamRed5.as
- * @author soda.C
- * @version 1.0
- * <br>Copyright (C), 2007 soda.C
- * <br>This program is protected by copyright laws.
- * <br>Program Name:GameHall
- * @data 2008-2-19
- */
- package org.sujun.red5.test
- {
- import flash.display.Sprite;
- import flash.net.NetConnection;
- import flash.events.NetStatusEvent;
- import flash.events.SecurityErrorEvent;
- import flash.net.Responder;
- /**
- * 测试flash与red5之间参数的传递
- */
- public class ParamRed5 extends Sprite
- {
- private var netConnection:NetConnection;
- public function ParamRed5():void
- {
- netConnection = new NetConnection();
- netConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
- netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
- netConnection.connect("rtmp://localhost/paramtest");
- }
- private function netStatusHandler(event:NetStatusEvent):void
- {
- trace("连接状态:" + event.info["code"]);
- switch (event.info["code"])
- {
- case "NetConnection.Connect.Success":
- trace("连接成功.....");
- //呼叫服务器的baseParam方法,传递基本参数,string,int,number,Boolean
- netConnection.call("baseParam", new Responder(baseParamResult),"soda.C",24,1000.1,false);
- //封装数组,int
- var ary:Array = new Array();
- ary.push(1);
- ary.push(2);
- ary.push(3);
- //封装数组,String
- var ary1:Array = new Array();
- ary1.push("a");
- ary1.push("b");
- ary1.push("c");
- netConnection.call("receiveArray", new Responder(baseParamResult),ary,ary1);
- break;
- case "NetStream.Play.StreamNotFound":
- trace("Stream not found: ");
- break;
- }
- }
- private function baseParamResult(obj:Object):void
- {
- trace(obj);
- trace("响应了.....");
- }
- private function securityErrorHandler(event:SecurityErrorEvent):void
- {
- trace("securityErrorHandler: " + event);
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...