代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
ActionScript
】
AS3中使用摄像头
作者:
/ 发布于
2011/1/3
/
1998
<div> <table style="font-family: monospace" class="actionscript codes"> <tbody> <tr class="li1"> <td style="line-height: 150%; font-family: Verdana, Monospace; font-size: 12px; font-weight: bold; margin-right: 10px"> <pre style="line-height: 150%; font-family: Verdana, Monospace; font-size: 12px; font-weight: bold; margin-right: 10px"><span style="color: #0099cc">if</span><span style="color: #66cc66">(</span><span style="color: blue">Camera</span>.<span style="color: blue">names</span>.<span style="color: blue">length</span>==<span style="color: #cc66cc">0</span><span style="color: #66cc66">)</span> <span style="color: #66cc66">{</span> <span style="color: #0000ff">var</span> _txt:<span style="color: blue">TextField</span> = <span style="color: #0000ff">new</span> <span style="color: blue">TextField</span><span style="color: #66cc66">(</span><span style="color: #66cc66">)</span>; _txt.<span style="color: #006600">thickness</span>=<span style="color: #cc66cc">5</span>; _txt.<span style="color: blue">textColor</span> = 0xFF0000; _txt.<span style="color: blue">width</span> = <span style="color: blue">stage</span>.<span style="color: blue">width</span>; _txt.<span style="color: blue">text</span> = <span style="color: #ff0000">"There is no usable camera."</span>; addChild<span style="color: #66cc66">(</span> _txt <span style="color: #66cc66">)</span>; <span style="color: #0099cc">return</span>; <span style="color: #66cc66">}</span> <span style="font-style: italic; color: #808080">// Get the default camera</span> <span style="color: #0000ff">var</span> _cam:<span style="color: blue">Camera</span> = <span style="color: blue">Camera</span>.<span style="color: #006600">getCamera</span><span style="color: #66cc66">(</span><span style="color: #66cc66">)</span>; <span style="font-style: italic; color: #808080">// If that doesn't work, look for one named "USB Video Class Video"</span> <span style="font-style: italic; color: #808080">// This is mostly for Mac</span> <span style="color: #0099cc">if</span><span style="color: #66cc66">(</span><span style="color: #66cc66">!</span>_cam<span style="color: #66cc66">)</span> <span style="color: #66cc66">{</span> <span style="color: #0000ff">var</span> <span style="color: blue">index</span>:<span style="color: blue">int</span> = <span style="color: #cc66cc">0</span>; <span style="color: #0099cc">for</span> <span style="color: #66cc66">(</span> <span style="color: #0000ff">var</span> i : <span style="color: blue">int</span> = <span style="color: #cc66cc">0</span> ; i <span style="color: #66cc66"><</span> <span style="color: blue">Camera</span>.<span style="color: blue">names</span>.<span style="color: blue">length</span> ; i++ <span style="color: #66cc66">)</span> <span style="color: #66cc66">{</span> <span style="color: #0099cc">if</span> <span style="color: #66cc66">(</span> <span style="color: blue">Camera</span>.<span style="color: blue">names</span><span style="color: #66cc66">[</span> i <span style="color: #66cc66">]</span> == <span style="color: #ff0000">"USB Video Class Video"</span> <span style="color: #66cc66">)</span> <span style="color: blue">index</span> = i; <span style="color: #66cc66">}</span> _cam = <span style="color: blue">Camera</span>.<span style="color: #006600">getCamera</span><span style="color: #66cc66">(</span> <span style="color: blue">String</span><span style="color: #66cc66">(</span> <span style="color: blue">index</span> <span style="color: #66cc66">)</span> <span style="color: #66cc66">)</span>; <span style="color: #66cc66">}</span> <span style="font-style: italic; color: #808080">// If we still don't have a cmaera, open the security panel</span> <span style="color: #0099cc">if</span><span style="color: #66cc66">(</span><span style="color: #66cc66">!</span>_cam<span style="color: #66cc66">)</span> <span style="color: #66cc66">{</span> Security.<span style="color: blue">showSettings</span><span style="color: #66cc66">(</span> SecurityPanel.<span style="color: blue">CAMERA</span> <span style="color: #66cc66">)</span>; <span style="color: #66cc66">}</span> _cam = <span style="color: blue">Camera</span>.<span style="color: #006600">getCamera</span><span style="color: #66cc66">(</span><span style="color: #66cc66">)</span>; _cam.<span style="color: blue">setMode</span><span style="color: #66cc66">(</span> <span style="color: #cc66cc">640</span>, <span style="color: #cc66cc">480</span>, <span style="color: #cc66cc">12</span>, <span style="color: #0000ff">true</span> <span style="color: #66cc66">)</span>; _video = <span style="color: #0000ff">new</span> <span style="color: blue">Video</span><span style="color: #66cc66">(</span> _cam.<span style="color: blue">width</span>, _cam.<span style="color: blue">height</span> <span style="color: #66cc66">)</span>; _video.<span style="color: #006600">attachCamera</span><span style="color: #66cc66">(</span> _cam <span style="color: #66cc66">)</span>;</pre> </td> </tr> </tbody> </table> </div>
试试其它关键字
同语言下
.
从网络服务器上下载DLL文件
.
flex音乐播放器
.
关机小脚本
.
Flash获取当前文件名、路径名
.
按中文字母排序
.
AS3 混淆加密
.
中国象棋博弈树搜索算法
.
获得当前flash文件加载的URL
.
AS2寻路算法
.
AS3中使用摄像头
可能有用的
.
从网络服务器上下载DLL文件
.
flex音乐播放器
.
关机小脚本
.
Flash获取当前文件名、路径名
.
按中文字母排序
.
AS3 混淆加密
.
中国象棋博弈树搜索算法
.
获得当前flash文件加载的URL
.
AS2寻路算法
.
AS3中使用摄像头
贡献的其它代码
Label
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3