0

I believe I made a quite simple mistake but I stuck and couldn't solve it.

When I try to create and apply a filter with the following code, I am getting TypeError: createjs.AlphaMaskFilter is not a constructor error from Firebug Console for the 2nd line.

var worldMask = new createjs.Bitmap("world-mask.png");
var mask = new createjs.AlphaMaskFilter(worldMask.image);
this.layers.world = new createjs.Bitmap("world.jpg");
this.layers.world.filters = [mask];
this.layers.world.cache(0, 0, worldMask.image.width, worldMask.image.height);

What I am trying to achieve is creating a transparent layer from a JPEG by masking it with a transparent PNG by the way.

Solution :

It seems EaselJS doesn't contain AlphaMaskFilter thing in the package. I've added it separately and voila.

4

1 回答 1

0

The minified version of EaseJS doesn't include several filters, including AlphaMaskFilter. You have to include them yourself:

EaselJS comes with a number of pre-built filters. Note that individual filters are not compiled into the minified version of EaselJS. To use them, you must include them manually in the HTML. [source]

于 2013-03-30T16:25:04.517 回答