HTML5: createjs images not displaying (intermittent)

走远了吗. 提交于 2019-12-12 06:05:50

问题


I have a HTML5 composition using createjs and associated libraries (via Flash CC 2014).

However, sometimes images that are loaded in through the manifest fail to display when the composition is loaded. I have tried making multiple requests for the image file in the manifest but alas, to no avail. I have tried switching to sprite sheets but then sometimes the sprite sheet image itself fails to display!

Does anyone know if anything can be done to stop this happening? I am unable to switch to an alternative framework, has to be createjs.

Thanks in advance.

EDIT: I am instantiating the images as follows:

Image loading in the manifest:

{src: "images/gridBG.png", id:"gridBG"},

The image-specific function as exported from Flash (I have changed the namespace):

(window.namespace1.namespace2.lib.gridBG = function() {
this.initialize(img.gridBG);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,992,886);

And when I come to use it:

// Layer 4
this.instance_1 = new window.namespace1.namespace2.lib.gridBG();
this.instance_1.setTransform(-339,151.6);

this.timeline.addTween(cjs.Tween.get(this.instance_1).wait(1));

I should reiterate that this is only an intermittent problem and I am unable to reliably replicate it, it just doesn't work sometimes.

来源:https://stackoverflow.com/questions/31681400/html5-createjs-images-not-displaying-intermittent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!