我學習EaselJS和我得到這個奇怪的錯誤:本地主機的機器上畫架JS安全限制
Unable to get image data from canvas because the canvas has been tainted by cross-origin data. easeljs-0.6.0.min.js:71
Uncaught An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images.
的事情是,我的兩個圖像是從localhost
- 我把它們保存在我的根目錄。這是我的代碼的樣子:
function init() {
var canvas = document.getElementById("demoCanvas");
var stage = new createjs.Stage(canvas);
var im = new createjs.Bitmap("dbz.jpg");
im.regX - im.image.width *.2;
im.regY - im.image.height *.2;
stage.addChild(im);
stage.update();
im.addEventListener("click", function() {
var seed = new createjs.Bitmap("seed.jpg");
stage.addchild(seed);
stage.update();
}); //end seed eventlistener
} //end function init()