HTML5: createjs images not displaying (intermitten

2019-09-17 03:44发布

问题:

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.