FAQ

mikechambers edited this page Feb 7, 2011 · 3 revisions

Common questions and answers about developing with EaselJS.

Why do I get browser security errors when working with certain APIs?

When working with loaded images and canvas on your local file system, some browsers
will throw security errors. This may occur when using SpriteSheetUtils or getObjectsUnderPoint,
and lead to a number of other repeating errors.

To avoid this, test on a web server (a local web server should work fine), or test with a browser
that doesn’t throw these errors (Safari seems to work).

If you have python installed on your system you can enable a simple web server that’s fine for
local testing by navigating to the directory where your project resides typing the following
at your command line:

python -m SimpleHTTPServer

Your project is now available at:

http://localhost:8000/

Note that you can tell EaselJS to ignore these errors by setting:

DisplayObject.suppressCrossDomainErrors = true;

If a security error is encountered, it will be caught and ignored. Any processing on the DisplayObject that caused the security error to occur will halt, but other DisplayObjects will continue to be processed.

Why do Shadow instances not appear to render correctly sometimes?

Currently, drop shadows generated by using a Shadow instance are clipped to the bounds of the DisplayObject that they are applied to. If the DisplayObject takes up its entire bounds, the Shadow will not be visible.

In addition, if you have a DisplayObject that has visible areas close to the bounds, then part of the Shadow may be clipped.

There are two current workarounds:

  1. Ensure that the DisplayObject has enough space between the visible section and bounds, to render the Shadow.
  2. Create a separate DisplayObject large enough to render the drop shadow, and position it under the original DisplayObject (placing both of these in a container can make this easier to manager).