Camera.names 在 Flash 生成器卷饼中不起作用
我在我的移动应用程序中使用相机类,我使用 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>
Im using camera class in my mobile application and I used Camera.names to fill my list and i tried to pass the selected value to getcamera() method but its not working.Here s my code
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Android 设备上,您只能访问后置摄像头。
http://help .adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera%28%29
On Android devices, you can only access the rear-facing camera.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera%28%29
编译移动版 Air 时,您需要确保您的 权限已正确放置在应用程序 xml 文件中。在这种情况下,您需要授予应用程序访问相机的权限才能使其正常工作。
When compiling Air for mobile, you need to make sure that your permissions are properly placed in the app xml file. In this case, you need to give your app permission to access the camera for it to work.