在MVC4中使用ScriptCam的问题

时间:2015-03-16 20:52:41

标签: c# model-view-controller flash scriptcam

我试图将ScriptCam https://www.scriptcam.com/demo_5.cfm用于我的MVC4项目。我已经下载了所需的文件,并按照网站上的说明进行操作。但是,当我去运行应用程序时,我在google调试器中出现问题(如下所示) -

  GET http://localhost:9171/QR/webcamlogo.png 404 (Not Found)
qr:145 Uncaught TypeError: undefined is not a function
qr:194 GET http://localhost:9171/QR/webcamlogo.png 404 (Not Found)
swfobject.js:4 GET http://localhost:9171/QR/scriptcam.swf 404 (Not Found)

现在我已经尝试弄清楚如何更改SWF.file的路径位置,但我的javascript体验只有一周之久。下面是我的查看文件...其余的javascript文件可以从我上面提供的链接中获取。

qr.cshtml

  @{
    ViewBag.Title = "Webcam";
}
        <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
        <script language="JavaScript" src="~/Webcam/scriptcam.js"></script>
        <script>
            $(document).ready(function () {
                $("#webcam").scriptcam({
                    onError: onError,
                    cornerRadius: 0,
                    onWebcamReady: onWebcamReady
                });
            });

            function onError(errorId, errorMsg) {
                alert(errorMsg);
            }
            function changeCamera() {
                $.scriptcam.changeCamera($('#cameraNames').val());
            }
            function onWebcamReady(cameraNames, camera, microphoneNames, microphone, volume) {
                $.each(cameraNames, function (index, text) {
                    $('#cameraNames').append($('<option></option>').val(index).html(text))
                });
                $('#cameraNames').val(camera);
            }
        </script> 


        <div style="width:330px;float:left;">
            <object type="application/x-shockwave-flash" data="scriptcam.swf" width="320" height="240" id="webcam" style="visibility: visible;"><param name="menu" value="false"><param name="wmode" value="direct"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="width=320&amp;height=240&amp;chatWindow=chatWindow&amp;path=&amp;zoom=1&amp;zoomChat=1&amp;rotate=0&amp;skewX=0&amp;skewY=0&amp;flip=0&amp;noFlashFound=%3Cp%3EYou%20need%20%3Ca%20href%3D%22http%3A%2F%2Fwww.adobe.com%2Fgo%2Fgetflashplayer%22%3EAdobe%20Flash%20Player%2011.7%3C%2Fa%3E%20to%20use%20this%20software.%3Cbr%2F%3EPlease%20click%20on%20the%20link%20to%20download%20the%20installer.%3C%2Fp%3E&amp;onError=function%20onError(errorId%2CerrorMsg)%20%7B%0A%09%09%09%09alert(errorMsg)%3B%0A%09%09%09%7D&amp;cornerRadius=0&amp;onWebcamReady=function%20onWebcamReady(cameraNames%2Ccamera%2CmicrophoneNames%2Cmicrophone%2Cvolume)%20%7B%0A%09%09%09%09%24.each(cameraNames%2C%20function(index%2C%20text)%20%7B%0A%09%09%09%09%09%24('%23cameraNames').append(%20%24('%3Coption%3E%3C%2Foption%3E').val(index).html(text)%20)%0A%09%09%09%09%7D)%3B%20%0A%09%09%09%09%24('%23cameraNames').val(camera)%3B%0A%09%09%09%7D&amp;id=webcam"></object>
            <div style="margin:5px;">
                <img src="webcamlogo.png" style="vertical-align:text-top">
                <select id="cameraNames" size="1" onchange="changeCamera()" style="width:245px;font-size:10px;height:25px;">
                <option value="0">HP Truevision HD (04f2:b35f)</option></select>
            </div>
        </div>
        <div style="width:135px;float:left;">
            <p><button class="btn btn-small" id="btn1" onclick="$('#decoded').text($.scriptcam.getBarCode());">Decode image</button></p>
        </div>
        <div style="width:200px;float:left;">
            <p id="decoded"></p>
        </div>



                </div>

1 个答案:

答案 0 :(得分:0)

解决

发布此内容后才注意到底部对象类型指向错误的方向

显示我一直挑剔注意到显而易见的ha