object404
object404

Reputation: 71

Referencing CreateJS from Flash CC 2015

Does anyone know how to reference createjs from Flash CC 2015?

I've been trying out this tutorial page for preloadJS:

http://code.tutsplus.com/tutorials/using-createjs-preloadjs-soundjs-and-tweenjs--net-36292

but when running the next line, the JavaScript console complains that createjs is undefined:

var preload = new createjs.LoadQueue(true);

I'm new to CreateJS and I'm trying to get a good grasp of the HTML5 workflow of CC 2015.

Upvotes: 1

Views: 700

Answers (3)

Bryan Wienczkowski
Bryan Wienczkowski

Reputation: 46

With regards to this URL that you referenced above: http://code.tutsplus.com/tutorials/using-createjs-preloadjs-soundjs-and-tweenjs--net-36292 This link looks like it is showing the output from Flash CS6 resultant from the publishing with CreateJS Tool kit.

On the other hand FlashCC has CreateJS "stuff" already baked into the IDE. All you have to do is set up a NEW FLA for "canvas" output. This output depends on the CreateJS tool kit when publishing. In addition, there are some differences between the tool kit for CS6 and canvas output in CC. In particular is the way the two handle imagery within the Flash environment. CreateJS tool kit for CS6 will bring each image separately. In contrast to FlashCC output, if you have two or more images, the code will automatically set up an image sprite sheet and an associated JSON file to tell the code where to "cut" programmatically to get the right imagery.

A sprite sheet for multiple images really helps in loading in assets; its quicker and it reducing the total number of server requests.

The preloadjs.min.js is simply code to aide in the loading in of the imagery assets. It will automatically be put into the HTML IF the code needs it.

I do this all the time with my creative work. I'll start out with crude PSD cuts of images that i need in my final out put. I will test publish to make sure it looks right. I will then, if feasible, make SVG (scale-able vector graphics) to replace the original PNGs, GIFs or JPGs I put into the FLA. After publishing to test, and if I was to remove all images for SVGs, my HTML output would no longer need that prelaodJS file any longer. And generally speaking if I made the correct choices (SVG for images or visa versa), my file overall size would also go down.

Hope this helps,

B

Upvotes: 1

object404
object404

Reputation: 71

Okay, we figured it out:

If you don't include a bitmap image in your Flash library, Flash will not put this into the HTML file, causing references to preloadJS to fail:

<script src="http://code.createjs.com/preloadjs-0.6.1.min.js"></script>

To force it to insert include, stick in any external image, and that will force it to put in preloadJS in the HTML file. A 1x1 transparent pixel will do. Cheers all!

Upvotes: 1

Barett
Barett

Reputation: 5948

You should have a line that says

<script src="http://code.createjs.com/createjs-2013.12.12.min.js"></script>`

See the preload.html file in your tutorial.

Upvotes: 0

Related Questions