views:

23

answers:

1

Hello,

Im trying to get pixel collision in one of the games im working on. It has to be a pixel collision on one row of pixels on the X axis. One of the things I tryed was:

var imgData = context2D.getImageData(160, 0, 3, Height);

And Height is afcorse the canvas height. But this gives me a Security error" code: "1000. This only happens if I put this script in front of my Draw function.

Can anybody help me out with this one?

A: 

You're probably using a drawImage() somewhere in your draw function with an image not on the same domain. Calling getImageData after drawing an image from another source will result in that error.

Kyle Jones
Yes im using drawImage() but the images are drawn in the same script and are lokated in the same folder. Is there a other way to draw images to the canvas then?
Oliver
Is this a script on your own machine opened through file://? When running a script from file:// you will always receive this error as there is no domain.
Kyle Jones
Is there a way to fix this. Or is this only in my own file:// and if I put it on a server it will be gone?? Because it hase to go online in the future.
Oliver
On the server it won't happen.If you're developing the script that way, you can add netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); in FireFox for now to make it work for you through file://
Kyle Jones
Ok thx for helping out:).
Oliver