简体   繁体   English

活动级别的Flex动作脚本代码

[英]Flex actionscript code for activitylevel

Can any one indicata me a small piece of code for making this progress bar move on mic activitylevel. 任何人都可以指示一小段代码来使此进度条在麦克风活动级别上移动。 ie, When spoken on the microphone the progressbar should indicate it.Also which works on internet explorer 即,当在麦克风上讲话时,进度条应指出它。这也适用于Internet Explorer

 <?xml version="1.0" encoding="utf-8"?>
 <mx:Application
 xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute"
 width="300"
 height="100"
creationComplete="init()">

<mx:Script>
<![CDATA[
 import mx.controls.Alert;
 import flash.net.NetStream;

 private var myMic:Microphone;
 private var recordingState:String = "idle";

 private function init():void {

    myMic = Microphone.getMicrophone();
    myMic.setSilenceLevel(0);
    myMic.rate = 44;
    myMic.gain = 100;

    micLevel.visible = true;
    Security.showSettings(SecurityPanel.MICROPHONE);
    myMic.setLoopBack(true);
    if (myMic != null)
    {
       myMic.setUseEchoSuppression(true);
       micLevel.setProgress(myMic.activityLevel, 100);
       addEventListener(Event.ENTER_FRAME, showMicLevel);
       //micLevel.setProgress(myMic.activityLevel, 100);
    }

 }



]]>
 </mx:Script>

<mx:ProgressBar x="0" y="36" mode="manual" id="micLevel" label="" labelPlacement="bottom" width="100" fontSize="10" fontWeight="normal"/>

</mx:Application>

You need to add a callback function for the event. 您需要为事件添加一个回调函数。 You have it defined as showMicLevel but you have no implementation of that function. 您已将其定义为showMicLevel,但没有该功能的实现。

   private function showMicLevel(e: Event):void{
      micLevel.setProgress(myMic.activityLevel, 100);
   }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM