|
|
|||||
Определить "занятость" камеры
Можно ли определить, доступна ли камера? Не факт наличия устройства, а работает она или нет. К примеру, если в системе несколько устройств, а устройство по умолчанию не доступно, т.к. используется другим приложением.
__________________
Ну все, теперь Забава м-о-я. Гы-гы, а корабль мой! |
|
|||||
свойство
// Imports import flash.media.Camera; import flash.media.Video; import flash.events.MouseEvent; // Variables var _camera:Camera = null; var _video:Video = null; // Add available cameras to ComboBox function displayAvailableCameras():void { // Loop thru cameras for(var i:int = 0; i < Camera.names.length; i++) { // Add items var cam:Camera = Camera.getCamera(String(i)) as Camera; comboBox.addItem( { label:cam.name, data:cam.name } ); // Select selected value to “USB Video Class Video” if it exists if(cam.name == “USB Video Class Video”) comboBox.selectedIndex = i; } } // Check to see if there is a camera available and use it if available function addCamera(e:MouseEvent):void { trace(“addCamera()”); // Tell user something is happening infoText.text = “Checking for a webcam” // Webcam does not exists at all. if (Camera.getCamera() == null) { trace(“You need a webcam”); // Inform user that they need a webcam on their computer here infoText.text = “Please connect a webcam” } // Webcam exists else { trace(“You have a webcam.”); // Set the desired camera by passing the selected index as a String _camera = Camera.getCamera( String(comboBox.selectedIndex) ); // Display camera feed as a video displayVideo(); } } // Display the video using the camera feed. function displayVideo():void { trace(“displayVideo()”); // Create video object _video = new Video(); // Attach camera _video.attachCamera(_camera); // Add video to stage addChild(_video); } // Show list of available cameras in ComboBox displayAvailableCameras() // Button functionality checkButton.addEventListener( MouseEvent.CLICK, addCamera ); checkButton.buttonMode = true;
__________________
return this... Последний раз редактировалось iNils; 13.01.2013 в 18:31. |
|
|||||
http://help.adobe.com/ru_RU/FlashPla...tml#getCamera()
Цитата:
__________________
משיח לא בא משיח גם לא מטלפן |
|
|||||
При уже работающей камере нет ни одного null (в моем случае из 3х), т.е. метод getCamera возвращает объект, не зависимо от того занят он или нет.
__________________
Ну все, теперь Забава м-о-я. Гы-гы, а корабль мой! |
Часовой пояс GMT +4, время: 21:36. |
|
« Предыдущая тема | Следующая тема » |
|
|