J'utilise la fonction ScanHardware pour obtenir la liste des caméras mise à jour. Si vous branchez une caméra sur mon Mac mini, la durée de la caméra est en cours de mise à jour. Si je branche la caméra Mon application se ferme brusquement.as3 scanHardware() fonction faisant planter mon application
<?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>
Si je
Camera.names
après que je débranche toutCamera
, Mon application se bloque.
Comment résoudre le problème?
Votre code fonctionne très bien pour moi dans Windows 10. Essayez-le dans d'autres machines, si cela fonctionne donc peut-être vous avez un problème dans votre machine (version AIR, pilote de cam, ...) – akmozo
sur Windows, j'ai essayé ça. Mais ça ne marche pas sur Mac. – Vishnu