加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flash在线录音

发布时间:2020-12-15 17:25:24 所属栏目:百科 来源:网络整理
导读:2007-11-08 15:11 1893人阅读 评论(3) 收藏 举报 轉:http://www.332500.net/post/41.htm 源码:import?flash.geom.Rectangle;var?name_time:String?=?"";//fsm_err._visible?=?true;fsm_err.useHandCursor=false;Graphspeed?=?20;TotalGraphSeconds?=?(1000
1893人阅读 评论(3) 收藏 举报

轉:http://www.332500.net/post/41.htm

源码:import?flash.geom.Rectangle;var?name_time:String?=?"";//fsm_err._visible?=?true;fsm_err.useHandCursor=false;Graphspeed?=?20;TotalGraphSeconds?=?(1000/Graphspeed)*myMictime;//myGraphBgColor?=?new?Color(myGraph.bg);myGraphBgColor.setRGB(OutColor);myBgColor?=?new?Color(myBg);myBgColor.setRGB(MicColor);//muButton_play_Color?=?new?Color(myButton.myPlay.bg);muButton_play_Color.setRGB(ButtonColor);muButton_save_Color?=?new?Color(myButton.mySave.bg);muButton_save_Color.setRGB(ButtonColor);//myBg._x?=?myBg._y=0;var?myBggrid:Rectangle?=?new?Rectangle(40,?40,?14,?14);myBg.scale9Grid?=?myBggrid;myBg._width?=?fsm_err._width=myWidth;myBg._height?=?fsm_err._height=myHeight;myButton._x?=?myWidth-20-myButton._width;myButton._y?=?myGraph._y=15;myGraph._x?=?30;var?myGraphgrid:Rectangle?=?new?Rectangle(5,?5,?17,?17);myGraph.bg.scale9Grid?=?myGraphgrid;myGraph.bg._width?=?myWidth-60-myButton._width;myGraph.bg._height?=?myButton._height;myGraph.totalBar._x?=?5;myGraph.totalBar._y?=?1;myGraph.totalBar._width?=?myGraph.bg._width-10;GraphHieght?=?(myGraph._height-20)/2;myGraph.micBar._visible?=?myGraph.playBar._visible=false;myGraph.micBar._x?=?myGraph.playBar._x=5;myGraph.micBar._y?=?myGraph.playBar._y=1;myGraph.micBar._height?=?myGraph.playBar._height=myGraph.totalBar._height=GraphHieght*2-2;//myGraph.myTime._x?=?myGraph.bg._width-myGraph.myTime._width;myGraph.myTime._y?=?myGraph.bg._height-myGraph.myTime._height;newConnection?=?new?NetConnection();//newConnection.connect("rtmp://www.evoca.com/liveCast");newConnection.connect(myFms);newConnection.onStatus?=?function(info)?{?if?(info.code?==?"NetConnection.Connect.Success")?{??//??fsm_err._visible?=?false;??//??newNetstream?=?new?NetStream(newConnection);??myMic?=?Microphone.get();??myMic.setRate(44);??myMic.setGain(50);??myMic.setSilenceLevel(0,?0);??//建立流、获取麦克风?}?else?{??fsm_err._visible?=?true;?}};//连接FMS到服务器myButton.recordMC.onRelease?=?function()?{?if?(this._currentframe?==?1)?{??this.gotoAndStop(2);??//??myButton.myPlay.txt.text?=?"播放";??//??recordRecording();??//??myGraph.playBar._visible?=?false;?}?else?{??recordStop();?}};myButton.myPlay.onRelease?=?function()?{?clearInterval(myPlayRecordGraph);?if?(myMic.muted?!=?true)?{??if?(this.txt.text?==?"播放")?{???this.txt.text?=?"停止";???recordStop();???//???newNetstream?=?new?NetStream(newConnection);???newNetstream.play(name_time);???//???//???playSeconds?=?0;???myPlayRecordGraph?=?setInterval(playGraph,?Graphspeed);??}?else?{???this.txt.text?=?"播放";???newNetstream.pause();??}?}};function?recordStop()?{?myButton.recordMC.gotoAndStop(1);?clearInterval(myRecordGraph);}function?playGraph()?{?playSeconds++;?if?(playSeconds<=playGraphSeconds)?{??myGraph.playBar._visible?=?true;??play_x?=?(myGraph._width-10)*(playSeconds/TotalGraphSeconds)+5;??myGraph.playBar._width?=?play_x-5;?}?else?{??myButton.myPlay.txt.text?=?"播放";??clearInterval(myPlayRecordGraph);?}}function?recordRecording()?{?var?now?=?new?Date();?name_time?=?now.getTime().toString();?newNetstream.attachAudio(myMic);?newNetstream.publish(name_time,?"record");?//?playGraphSeconds?=?0;?//?myGraph.line.clear();?//?clearInterval(myPlayRecordGraph);?//?myRecordGraph?=?setInterval(updateGraph,?Graphspeed);}function?updateGraph()?{?if?(myMic.muted?!=?true)?{??playGraphSeconds++;??myGraph.micBar._visible?=?true;??myGraph.myTime.txt.text?=?"已录制"+Math.floor(playGraphSeconds/(1000/Graphspeed))+"秒";??if?(playGraphSeconds<=TotalGraphSeconds)?{???line_x?=?(myGraph._width-10)*(playGraphSeconds/TotalGraphSeconds)+5;???myGraph.micBar._width?=?line_x-5;???with?(myGraph.line)?{????lineStyle(1,?GraphColor,?60);????moveTo(line_x,?GraphHieght+(((myMic.activityLevel-45))/55)*(GraphHieght-2));????lineTo(line_x,?GraphHieght-(((myMic.activityLevel-45))/55)*(GraphHieght-2));???}??}?else?{???myButton.recordMC.gotoAndStop(1);???clearInterval(myRecordGraph);??}?}?//?end?if????????????????????????????????????????????????????????????????????????????}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读