2 Replies Latest reply on Sep 20, 2011 7:21 PM by Yue_Hong

    Displaying a webcam’s video in a Flex VideoDisplay control

    Yue_Hong Level 1



      I am trying to get flex to display webcam's video, but I keep on getting the error message of


      1061: Call to a possibly undefined method getCamera through a reference with static type Class.Camera.mxml/Camera/srcline 11Flex Problem
      1067: Implicit coercion of a value of type Camera to an unrelated type flash.media:Camera.Camera.mxml/Camera/srcline 15Flex Problem


      Here is my source code:



      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  import mx.controls.Alert;
                  private function videoDisplay_creationComplete() : void
                      var webcam:Camera = Camera.getCamera();
                      if (webcam) 
                          Alert.show("Oops, we can't find your camera.");
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <mx:Panel title="Video">
                  <mx:VideoDisplay id="cameraDisplay" creationComplete="videoDisplay_creationComplete();" width="320" height="240" />        
              <s:Button label="reload camera" click="videoDisplay_creationComplete();"/>



      How can I solve it? Thanks.