医药CRM系统开发

自已做医药CRM系统有四年了,终于可以算个产品了,努力市场化,今年重种将医药营销的理念加入CRM

导航

视频会议开发分析

Posted on 2008-07-27 20:15  hhq80  阅读(266)  评论(0编辑  收藏  举报

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
 <![CDATA[
  import flash.events.NetStatusEvent;
  import flash.net.NetConnection;
   
  import flash.display.Sprite;
  import flash.media.Camera;
  import flash.media.Video;
  import flash.text.TextField;
  import mx.controls.Alert;
  import cn.mediasky.media.*;
  
     import flash.display.Sprite;
     import flash.events.*;
     import flash.media.Microphone;
     import flash.system.Security;
     import flash.system.SecurityPanel;
     import flash.media.Microphone;
     import flash.media.SoundLoaderContext;
  
  private var nc:NetConnection;
  private var active_mic:Microphone = Microphone.getMicrophone();
  private   function ConnectHandler():void
  {
   
   trace("开始连接服务");
   nc=new NetConnection();
   nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            nc.connect("rtmp://www.resincrm.com/HelloServer");   
   
  }
  public function CloseHandler():void
  {
   trace("关闭连接");
   nc.close(); 
  }
  public  function netStatusHandler(event:NetStatusEvent):void
  {
           trace("connected is: " + nc.connected);
   trace("event.info.level: " + event.info.level);
   trace("event.info.code: " + event.info.code);
   
   switch (event.info.code)
            {
                case "NetConnection.Connect.Success":
                 Alert.show("Congratulations! you're connected" + "\n");
                 break;
                case "NetConnection.Connect.Rejected":
                 trace ("Oops! the connection was rejected" + "\n");
                 break;
    case "NetConnection.Connect.Closed":
     trace("Thanks! the connection has been closed" + "\n");
     break;
        }
   }
          
            public var cam:Camera;
   public function checkCamBusy(userCam:Camera):void
   {
    var chkTime:Number=0;
    var intervalID:Number;
    function callback():void
    {
     if(userCam.currentFPS>0)
     {
      //设备可用
      clearInterval(intervalID);
     }
     else
     {
      chkTime++;
      if(chkTime>30)
      {
       //设备忙
       clearInterval(intervalID);
 
       //Alert.show("摄像头被占用");
      }
     }
     
    }
    intervalID = setInterval(callback, 50);
   }
            public function initCamera():void {
                // Initialize the variable.
                cam = Camera.getCamera();
             var mic:Microphone = Microphone.getMicrophone();
            // Security.showSettings(SecurityPanel.MICROPHONE);

             mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);

                    
             if (mic != null) {
                 mic.setUseEchoSuppression(true);
     mic.setLoopBack(true);//本地响声,如果不用耳机会有回声
                 mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                 mic.addEventListener(StatusEvent.STATUS, statusHandler);
             }               
                if(cam!=null)
                {
                 cam.addEventListener(StatusEvent.STATUS,CameraStatusHander);
                 cam.setMode(160,120,15);
                 
                 
                 myVid.attachCamera(cam);
                 checkCamBusy(cam);
                }
                else
                {
                 Alert.show("摄像头已经被其它应用程序使用,请关闭已占用的程序后再试!");
                }
            }
   public function onMicStatus(event:StatusEvent):void
   {
       if (event.code == "Microphone.Unmuted")
       {
           Alert.show("Microphone可以访问了.");
       }
       else if (event.code == "Microphone.Muted")
       {
            Alert.show("Microphone access was denied.");
       }
   }           
            public function CameraStatusHander(event:StatusEvent):void
            {
                 switch (event.code)
        {
            case "Camera.Muted":
                Alert.show("Camera用户单击了'拒绝'。");
                break;
            case "Camera.Unmuted":
                Alert.show("Camera用户单击了'接受'。");
                break;
        }

            }
        private function activityHandler(event:ActivityEvent):void {
            Alert.show("activityHandler: " + event);
        }

        private function statusHandler(event:StatusEvent):void {
            Alert.show("statusHandler: " + event);
        }  

        
 ]]>
</mx:Script>

 <mx:Button x="10" y="538" label="Connect" id="btnConnect"  click="ConnectHandler();"/>
 <mx:Button x="108" y="538" label="Close" id="btnClose" click="CloseHandler();"/>
 <mx:Label x="211" y="542" width="109" id="lbInfo"/>
 <mx:Button x="10" y="468" label="Camera" id="btnVideo" click="initCamera();"/>

 
 <mx:Panel x="10" y="10" width="183" height="165" layout="absolute" id="cam1" title="黄和清" fontFamily="Arial" fontSize="12" color="#0B0D3C">
    <mx:VideoDisplay id="myVid" width="160" height="120"
        creationComplete="initCamera();" x="0" y="0"/> 
 </mx:Panel>
 
</mx:Application>