2012-01-19 2 views
2

내가 만드는 응용 프로그램에 대한 또 다른 질문입니다. 따라서 사용자가 가입하면 사진을 찍어야합니다. 나는 cameraUI를 사용하지 않고 이것을하고 싶다. 나는 일종의 튜토리얼을 따라 갔지만 애플리케이션은 실행되지 않는다. 오류는 없지만 카메라는 표시되지 않습니다. 다음은 내가 한 일입니다.Flex 카메라 UI가없는 카메라 사용

<?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" 
     xmlns:mx="library://ns.adobe.com/flex/mx" 
     activate="view1_activateHandler(event)" 
     title="Camera Test"> 
    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 


    <fx:Script> 
     <![CDATA[ 
      import mx.core.UIComponent; 

      import spark.components.Image; 
      import spark.components.VideoDisplay; 
      import spark.components.ViewNavigator; 

      private var cam:Camera; 
      private var video:Video; 
      private var uic:UIComponent; 

      protected function cameraButton_clickHandler(event:MouseEvent):void 
      { 
       if(!cam){ 
        trace("whut"); 
        cameragroup.removeAllElements(); 
        this.cam=Camera.getCamera(); 
        cam.setQuality(0,100); 

        cam.setMode(cameragroup.width, cameragroup.height, 30, false); 
        if(cam){ 
         trace("camera added"); 
         this.video=new Video(cameragroup.width, cameragroup.height); 

         video.attachCamera(cam); 

         this.uic=new UIComponent(); 
         uic.addChild(video); 

         var m:Matrix=new Matrix(); 
         m.rotate(Math.PI/2); 
         video.transform.matrix=m; 

         var m2:Matrix = new Matrix(); 
         m2.translate((video.width+cameragroup.width/4)-this.frame.x, 5); 
         uic.transform.matrix=m2; 

         cameragroup.addElement(uic); 
         cameraButton.label="shoot"; 
        } 
       } 
      } 

      protected function view1_activateHandler(event:Event):void 
      { 
       this.cameraButton.label="shoot"; 
      } 

     ]]> 
    </fx:Script> 

    <s:VGroup width="100%" height="100%" horizontalAlign="center" paddingBottom="30" paddingLeft="10" paddingRight="10" paddingTop="30"> 
     <s:Group id="frame" width="100%" height="100%"> 
      <s:Rect width="100%" height="100%"> 
       <s:fill> 
        <s:SolidColor color="0x000000" alpha="0.2"/> 
       </s:fill> 
      </s:Rect> 
      <s:Group id="cameragroup" width="210" height="220"/> 
     </s:Group> 

     <s:Spacer height="100%"/> 
     <s:HGroup width="100%" horizontalAlign="center"> 
      <s:Button id="cameraButton" width="50%" height="80" label="start" click="cameraButton_clickHandler(event)"/> 
     </s:HGroup> 
    </s:VGroup> 
</s:View> 

이것은 전체 .mxml 파일입니다. 그리고 코드를 한 줄씩 간과했지만 잘못된 점은 발견하지 못했습니다.

Grtz

당신의 응용 프로그램 app.xml

에서

+0

권한 :

<uses-permission android:name="android.permission.CAMERA"/> 

이 여기에 자세히 설명되어있다? (최소 15 자) – shaunhusain

+2

내 MyAWESOME-app.xml에 \t \t \t -> – shaunhusain

+0

감사합니다! 나는 하룻밤을 보냈다! –

답변