0

我在我的移动应用程序中使用相机类,我使用 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>
4

2 回答 2

1

在 Android 设备上,您只能访问后置摄像头。

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera%28%29

于 2011-06-15T14:30:10.690 回答
0

编译 Air for mobile 时,您需要确保您的权限正确放置在应用 xml 文件中。在这种情况下,您需要授予您的应用访问相机的权限才能使其正常工作。

于 2011-05-11T15:00:24.367 回答