0

I am having an issue with AlphaMaskFilter using createJS. I am using the example code from previous discussions on the forum and including both alphamaskfilter.js from github and easelJS from the CDN and am still getting undefined is not a function. Can someone offer a different look at this issue? I am choosing not to include preloader because of the high volume on the site.

lenses = new Image(); lenses.onload = function() {

var image = new createjs.Bitmap('images/reflection.png');
var maskImage = new createjs.Bitmap('images/1-1.png');

var amf = new createjs.AlphaMaskFilter(maskImage.image);
image.filters = [amf];
image.cache(0, 0, maskImage.image.width, maskImage.image.height);

    glasses_container.addChild(image);

    stage.update();
}
lenses.src = 'images/reflection.png'

Previous Discussion Examples http://jsfiddle.net/Bpz88/193/ http://community.createjs.com/discussions/easeljs/584-alphamapfilter-using-alpha-png-image-to-mask-jpg

3066d0
  • 1,853
  • 1
  • 14
  • 18

1 Answers1

1

Filters currently are not included in the EaselJS package, so you have to include the filters on the page yourself, do you do that?

olsn
  • 16,644
  • 6
  • 59
  • 65
  • Yes they are both included, the canvas functionality is initialized on page load as well. – 3066d0 Sep 11 '13 at 18:10
  • In the JS-fiddle the only RAW-file from github is implemented, which is served and interpretet as a "text/plain" - if you have that in your real project-file as well, then my guess would be that that's the issue. This is the error i get: Refused to execute script from 'https://raw.github.com/CreateJS/EaselJS/master/src/easeljs/filters/AlphaMaskFilter.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. – olsn Sep 11 '13 at 18:22
  • I've tried to remedy that using type='javascript' and it seems to clear that error :( – 3066d0 Sep 11 '13 at 18:25
  • Your code is fine, it is the implementation of the file from github raw - raw is no CDN service! and should also not be treated as one! I just tested your code lokally and implemented the filter myself, and it worked – olsn Sep 11 '13 at 18:35
  • 1
    Thank you, that was the issue! Really relieved! – 3066d0 Sep 11 '13 at 19:17