My problem is, i got a shooter game and i want a homescreen, with a startbutton and when u die an endscreen. But when I am in the homescreen and try to press the button (doesnt matter where i press mousebutton in the canvas i get the next error:
Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
Uncaught An error has occured. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images.
And i really do not know how to fix this.. can anyone help me out, here some code:
// Here i create the startbutton
startimp = new Image()
startimp.src = "images/start.png";
herlaadknopimp = new Image()
herlaadknopimp.src = "images/herlaadknop.png";
// creating the startbackground
startachtergrondimp = new Image();
startachtergrondimp.src = "images/startachtergrond.png";
// loading the game function
function laadSpel()
{
removing the first background from stage, and the startbutton
stage.removeChild(startachtergrondimp);
stage.removeChild(startimp);
//adding the second backround
achtergrond2 = new Bitmap(achtergrondimp);
achtergrond2.x = achtergrond2.y = 0;
stage.addChildAt(achtergrond2,0);
//character
cartman = new BitmapAnimation(cartman);
cartman.x = 150;
cartman.y = 390;
stage.addChildAt(cartman,2);
startSpel = true;
}
I dont know if this last code is nescessary.. i just dont know what to do. If i only load the playbackground IN HTML then it works fine, but im trying to get these 3 backgrounds in js and it just wont work. Any help please 