Vis*_*hnu 9 macos camera actionscript flex3 actionscript-3
我正在使用ScanHardware功能来获取更新的相机列表.如果将相机插入我的Mac mini,则会更新相机长度.如果我插入相机我的应用程序突然关闭.
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
height="280"
width="280"
creationComplete="test1()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
public var hardwareTimer:Timer;
public function test1():void{
hardwareTimer = new Timer(5000);
hardwareTimer.addEventListener(TimerEvent.TIMER,refreshHardware);
hardwareTimer.start();
}
public function refreshHardware(ev:TimerEvent):void{
flash.media.scanHardware();
Alert.show(Camera.names.length.toString());
}
]]>
</fx:Script>
</s:WindowedApplication>
Run Code Online (Sandbox Code Playgroud)
如果我
Camera.names在拔掉任何电源后使用Camera,我的应用程序就会崩溃.
如何解决这个问题?
Actionscript 错误不应导致应用程序崩溃。当应用程序崩溃时,通常是因为它尝试在本机级别执行非法操作,例如写入保留/无效内存。我首先会查找相机或 USB 的问题。如果您可以使用不同品牌的网络摄像头重现问题,那么您可以排除摄像头硬件和驱动程序的问题。如果您可以在另一台 Mac 上重现该问题,则问题可能不是 USB。
| 归档时间: |
|
| 查看次数: |
161 次 |
| 最近记录: |