0

The self invoking module exported by Adobe_Animate does not initialize properly with requirejs. The module (Test.js) looks like this:

(function (cjs, an) {

var p; // shortcut to reference prototypes var lib={};var ss={};var img={}; lib.ssMetadata = [];

// symbols:

// stage content: (lib.Untitled1 = function(mode,startPosition,loop) { this.initialize(mode,startPosition,loop,{});

// Layer_1 this.shape = new cjs.Shape(); this.shape.graphics.f().s("rgba(0,0,0,0.498)").ss(23.2,1,1).p("AluoHQlRT1R6kY"); this.shape.setTransform(89.7,133);

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

}).prototype = p = new cjs.MovieClip(); p.nominalBounds = new cjs.Rectangle(133.8,193.4,111.9,127.3); // library properties: lib.properties = { id: 'E010D875D1E4F54FAE30E27157A43177', width: 200, height: 248, fps: 24, color: "#BB0909", opacity: 1.00, manifest: [], preloads: [] };

.....

an.getComposition = function(id) { return an.compositions[id]; }

})(createjs = createjs||{}, AdobeAn = AdobeAn||{}); var createjs, AdobeAn;

My config:

require.config({
        shim: {
            easel: {
                exports: 'createjs'
            },

            testjs: {
                deps: ['createjs'],
                exports: 'testjs'
            }
        },
        paths: {
            easel: 'libs/easeljs.min',
            test: "Test"

        }
    });

I have tested that createjs gets loaded, but probably too late. The errors I get are: cjs.MovieClip is not a constructor . The same error as I get if I load Test.js before createjs.js in a html file, like so:

<script src="Test.js"></script> 
<script src="libs/createjs.js"></script>
Stig
  • 1
  • 1

1 Answers1

0

Seems like I got it working - without knowing exactly how. But, it seems in my setup the require.config has no effect. Even after commenting out the whole require.config, it still works!

Stig
  • 1
  • 1
  • Correction: it works most of the time. About 1 in 5 time it fails. This happens with and without the require.config. – Stig Nov 30 '17 at 09:08