1 Reply Latest reply on May 28, 2011 10:28 AM by Shongrunden

    Video on Mobile

    Gregory Lafrance Level 6

      I'm trying to attach my camera to a simple mobile app, here is the view, but the video does not display:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="Your Camera View"
        creationComplete="init();">
       <fx:Script>
        <![CDATA[
         import flash.media.Camera;
         
         import mx.core.UIComponent;
         
         import spark.components.Label;
         
         private var nearVideo:Video;
         private var nearCam:Camera;
         private var uic:UIComponent = new UIComponent();
         
         private function init():void
         {
          nearVideo = new Video(320, 240);  
          var m:Matrix = new Matrix(); 
          m.rotate(Math.PI/2);  
          this.nearVideo.transform.matrix = m; 
          var label:Label = new Label();
          if (Camera.isSupported) { 
           nearCam = Camera.getCamera(); 
           label.text = "Video IS supported on your device.";
          }else{
           label.text = "Video NOT supported on your device.";
          }
          nearCam.setMode(320, 240,10); 
          nearVideo.attachCamera(nearCam); 
          uic.addChild(nearVideo);
          nearCam.setMode(320, 240,10); 
          nearVideo.width = 320;
          nearVideo.height = 240;
          vg.addElement(label);
          vg.addElement(uic);
         }
        ]]>
       </fx:Script>
       <s:VGroup id="vg"/>
      </s:View>