我的javascript有什么问题?它一直让我在Dreamweaver中出错

时间:2014-04-22 04:58:46

标签: javascript

在第29行(pixelScan)它显示我在Dreamweaver中的错误我想知道什么是错的请帮助,我不知道错误是什么,我是javascript的菜鸟所以请帮助我:< / p>

<script type="text/javascript">
var processes = {

  timerCallback: function() {
    if (this.myVideo.paused || this.myVideo.ended) {
      return;
    }
    this.videocontentPlayer.drawImage(this.myVideo, 0, 0, this.width, this.height);
    this.pixelScan();
    var self = this;
    setTimeout(function () {
      self.timerCallback();
      }, 0);
  },

  doLoad: function() {
    this.myVideo = document.getElementById("myVideo");
    this.videoPlayer = document.getElementById("videoPlayer");
    this.videocontentPlayer = this.videoPlayer.getContext("2d");
    this.videoPlayer2 = document.getElementById("videoPlayer2");
    this.videocontentPlayer2 = this.videoPlayer.getContext("2d");
    var self = this;
    this.myVideo.addEventListener("playing", function() {
      self.width = self.myVideo.videoWidth;
      self.height = self.myVideo.videoHeight;
      self.timerCallback();
    }, false);
  }

  pixelScan: function() {
    var frame = this.videocontentPlayer.getImageData(0, 0, this.width, this.height);
    for (var i = 0; i < frame.data.length; i++) {
      var r = frame.data[i];
      var g = frame.data[i+1];
      var b = frame.data[i+2];
      if (g > 120 && 2 > 50 && r < 165 && b < 60)
        frame.data[i + 3] = 0;
    }
    this.videocontentPlayer2.putImageData(frame, 0, 0);
    return;
  }
}
</script>

2 个答案:

答案 0 :(得分:2)

缺少逗号分隔符:

}, //here

pixelScan: function() {

答案 1 :(得分:0)

pixelScan不是一个功能。

您在pixelScan之前错过了一个逗号分隔符。

应该是

this.myVideo.addEventListener("playing", function() {
        self.width = self.myVideo.videoWidth;
        self.height = self.myVideo.videoHeight;
        self.timerCallback();
        }, false);
    }
},
pixelScan: function() {