var u:uint = 1
var cam2 = Camera.getCamera(String(1))
cam2.setMode(480,500, 25)
cam2.setQuality(0,100)
vid2.attachCamera(cam2)
vid2.rotation = -90
vid2.y = 480
vid2.x = 0
swtch.addEventListener(MouseEvent.CLICK, pal)
function pal(event:MouseEvent)
{
if(u == 1) {
u = 0
cam2 = Camera.getCamera(String(u))
vid2.attachCamera(cam2);
vid2.rotation = 90
vid2.x = 500
vid2.y = 0
}
else if ( u == 0 ) {
u = 1
cam2 = Camera.getCamera(String(u))
vid2.attachCamera(cam2)
vid2.rotation = -90
vid2.y = 480
vid2.x = 0
}
trace('vidx' + vid2.x + 'vidy' + vid2.y)
}
上面的代码在单击按钮时在前后之间切换摄像头。当我使用捆绑在 apk 文件中的 air 3.4 上面的代码在我的手机(os android 4.2)上完美运行时,当我将 air 16.0 捆绑在 apk 文件中时,前置摄像头是视频流,但单击按钮以在前后摄像头之间切换时应用程序崩溃