0 Replies Latest reply on Jan 11, 2009 7:40 PM by babasoaja

    I am trying to make use of my camera but it doesnt display

    babasoaja
      Hello Please can someone help me, i am try to make a application that uses my camera but i dont know what is wrong with my code. i have pasted the code below. I we be very glad for a help. Thank you.


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:local="*" layout="absolute" width="100%" creationComplete="init()" height="100%">
      <mx:Script>
      <![CDATA[
      import mx.events.EffectEvent;
      import mx.effects.easing.*;
      import mx.controls.Alert;
      import mx.managers.PopUpManager;
      import flash.media.*;

      public var video:Video;

      public function CameraExample():void {

      var camera:Camera = Camera.getCamera();


      if (camera != null) {
      camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
      video = new Video(camera.width * 2, camera.height * 2);
      video.height = 300;
      video.width = 300;

      video.attachCamera(camera);
      //Alert.show("reached");
      topLeftPane.addChild(video);

      } else {
      trace("You need a camera.");
      }
      }

      private function activityHandler(event:ActivityEvent):void {
      trace("activityHandler: " + event);
      }
      private var logInForm:LoginForm = new LoginForm();
      private function showLoginPopup():void
      {
      logInForm = LoginForm(PopUpManager.createPopUp(this,LoginForm,true));
      PopUpManager.centerPopUp(logInForm);
      }

      private function init():void
      {
      //Alert.show("working");
      //pasues.play()
      comeIn.xTo = 0;
      comeIn.yTo = 8.35;
      comeIn.play();
      comeIns.xTo = 0;
      comeIns.yTo = 225;
      comeIns.play();
      MainPane.xTo = 180.35;
      MainPane.yTo = 9;
      MainPane.play();
      BannerPaneEffect.xTo = 0;
      BannerPaneEffect.yTo = 1;
      BannerPaneEffect.play();
      MenuPaneEffect.play();

      CameraExample();

      }
      ]]>
      </mx:Script>
      <mx:Sequence>
      <mx:Move id="comeIn" target="{topLeftPane}" duration="1300" easingFunction="Bounce.easeOut" />
      <mx:Move id="comeIns" target="{BottomLeftPane}" duration="1300" easingFunction="Bounce.easeOut" />
      <mx:Move id="MainPane" target="{MainPaneBar}" duration="1300" easingFunction="Bounce.easeOut" />
      <mx:Move id="BannerPaneEffect" target="{BannerPane}" duration="1700" easingFunction="Bounce.easeOut" />
      <mx:Fade id="MenuPaneEffect" target="{MenuPane}" alphaFrom="0.0" alphaTo="1.0" duration="1300" easingFunction="Bounce.easeOut" />
      </mx:Sequence>
      <mx:Canvas x="62" y="14" width="900" height="153" horizontalCenter="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:ApplicationControlBar width="900" height="95" x="0" id="BannerPane" y="-100">
      </mx:ApplicationControlBar>
      <mx:ApplicationControlBar width="900" height="47" x="0" y="100" id="MenuPane">
      <mx:Canvas width="100%" height="42">
      <mx:ButtonBar x="152.95" y="4" dataProvider="viewstack1" width="576.05" height="35">
      </mx:ButtonBar>
      <mx:Button x="799" y="6" height="32" width="73" label="Log IN" click="showLoginPopup()"/>
      </mx:Canvas>
      </mx:ApplicationControlBar>
      </mx:Canvas>
      <mx:Canvas y="157" width="900" height="570" horizontalCenter="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:ApplicationControlBar width="717" height="514.5834" id="MainPaneBar" x="900" y="9.95">
      <mx:ViewStack id="viewstack1" width="100%" height="100%">
      <mx:Canvas label="Home" width="100%" height="100%" >
      </mx:Canvas>
      <mx:Canvas label="Products" width="100%" height="100%">
      </mx:Canvas>
      <mx:Canvas label="Contact Us" width="100%" height="100%">
      </mx:Canvas>
      <mx:Canvas label="Profile" width="100%" height="100%">
      </mx:Canvas>
      </mx:ViewStack>
      </mx:ApplicationControlBar>
      <mx:ApplicationControlBar width="175" height="208.22916" id="topLeftPane" x="0" y="-300">
      </mx:ApplicationControlBar>
      <mx:ApplicationControlBar width="175" height="187.1875" id="BottomLeftPane" x="0" y="1900">
      </mx:ApplicationControlBar>
      </mx:Canvas>

      </mx:Application>