Search code examples
htmlcreatejsadobe-animate

How can I load library assets from a separate project at runtime?


I'd like to set up a project so that there are two HTML5 createjs projects, with one loading assets from the other at runtime.

This is so that I can have part of my project that's shared across lots of files, and can be updated separately.

Ideally, I'd load these from a separate source, like how swf files can load assets from other swf files. Still within the same domain.

How can I set that up with createjs? I know I can easily load bitmaps and text files like you'd load any file in javascript, but I'd like to load vector graphics created using Animate and be able to render them on the stage.


Solution

  • The HTML5 exports are the resulting js files, along with some other additional assets, like images or sounds. Therefore, all you need to do is export both .fla files and load both of the resulting js files in the HTML document at the same time.

    <script src="js/export.js"></script>
    <script src="js/export2.js"></script>
    

    After all that is loaded, you will be able to use vector graphics from both files, as long as they are properly referenced.