>我在我的移动应用程序中使用相机类,我使用 Camera.names 来填充我的列表,我试图将所选值传递给 getcamera() 方法,但它不起作用。这是我的代码
private function init():void
{
if (Camera.names.length == 0) {
lab.text = "No camera attached";
list.enabled = false;
textArea.enabled = false;
}
}
protected function list_changeHandler(event:IndexChangeEvent):void
{
var tList:List = evt.currentTarget as List;
var cameraName:String = tList.selectedIndex.toString();
camera = Camera.getCamera(cameraName);
vid=new Video();
vid.attachCamera(camera);
UIc.addElement(vid as IVisualElement);
textArea.text = ObjectUtil.toString(camera);
}
<s:List id="list"
dataProvider="{Camera.names as ArrayCollection}"
width="200"
change="list_change(event);" />
<s:Group id="UIc" x="68" y="253" width="368" height="281">
</s:Group>
在安卓设备上,您只能使用后置摄像头。
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera%28%29
编译适用于
移动设备的 Air 时,您需要确保您的权限正确放置在应用程序 xml 文件中。 在这种情况下,您需要授予应用访问相机的权限才能使其正常工作。