<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<script type="text/javascript" src="../swfobject.js"></script>
<title>AS3 在线拍照</title>
<script language="javascript" type="text/javascript">
function getSwf(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function getObj(id){return document.getElementById(id);}
//设置相应id元素为不可用状态
function setGray(id){
getObj(id).disabled=true;
}
//设置相应id元素为正常状态
function setNor(id){
getObj(id).disabled=false;
}
function setView(){
getSwf("movie").setView();
setGray("view");setNor("reset");setNor("jpg");setNor("save");
}
function setJpeg(){
getSwf("movie").setJpeg();
//setGray("view");setNor("reset");setNor("jpg");setNor("save");
}
function setReset(){
getSwf("movie").setReset();
setNor("view");setGray("reset");setGray("jpg");setGray("save");
}
function setSave(url){
getSwf("movie").setSave(url);
}
function cameraOk(){
setNor("view");setGray("reset");setGray("jpg");setGray("save");
}
function cameraNo(){
setGray("view");setGray("reset");setGray("jpg");setGray("save");
alert("没有找到摄像头,不能使用拍照功能!");
}
function saveOk(url){
setReset();
if(confirm("图片上传成功,是否查看?")){window.open(url);}
}
function saveNo(){
setNor("view");setGray("reset");setGray("jpg");setGray("save");
alert("上传失败,请重新拍照再上传!");
}
</script>
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
overflow: hidden;
}
-->
</style>
</head>
<body onkeydown="if(event.keyCode===32){setView();}">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div id="swfview" style="text-align:center;padding:3px;">多功能flash读取器!<br /><br />如不能观赏,请确认是否正确安装 <a href="#">Flash 插件</a>.</div></td>
</tr>
<tr>
<td align="center"><input type="button" id="view" onClick="setView()" value=" 拍 照 ">
<input type="button" id="reset" onClick="setReset()" value=" 重 拍 " disabled>
<input type="button" id="jpg" onClick="setJpeg()" value=" JPEG " disabled>
<input type="button" id="save" onClick="setSave('./save.asp')" value=" 保 存 " disabled></td>
</tr>
</table>
<script type="text/javascript">
var fo = new FlashObject("Camera.swf" + "?t=" + Math.random(), "movie", "1015px", "585px", "7", "");
fo.addParam("quality", "high");
fo.addParam("wmode", "transparent");
fo.addParam("menu", "false");
fo.addParam("scale", "exactfit");
fo.write("swfview");
</script>
</body>
</html>