Is there any other way开发者_高级运维 to access the camera using ActionScript 3 other than
import flash.media.Camera;
videoInstance.attachCamera(cameraInstance);
Or should I use any API s? If so, please suggest me any API suitable and some tutorials if possible.
Thank You very much for helping. . . My previous post on Camera is How to increase the Quality of the camera using AS3?If you need better Camera quality... check this ActionScript Mobile Flex Project.
This is the main file
package
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.ActivityEvent;
import flash.events.MouseEvent;
import flash.media.Camera;
import flash.media.Video;
public class iosTest extends Sprite
{
private var cam:Camera;
private var vid:Video;
public function iosTest()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
cam = Camera.getCamera();
if (!cam)
{
trace("No camera is installed.");
}
else
{
connectCamera();
}
}
private function connectCamera():void
{
cam.setMode(640, 480, 25);
cam.setQuality(0,100);
vid = new Video();
vid.width = cam.width;
vid.height = cam.height;
vid.attachCamera(cam);
addChild(vid);
stage.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(e:MouseEvent):void
{
return;
switch (cam.width) {
case 160:
cam.setMode(320, 240, 10);
break;
case 320:
cam.setMode(640, 480, 5);
break;
default:
cam.setMode(160, 120, 15);
break;
}
removeChild(vid);
connectCamera();
}
}
}
精彩评论