2

We're currently transitioning from AS2 in CS6 to the HTML5 Canvas with Javascript in Adobe Animate CC, while trying to retain as much of the functionality we've built in AS2 over the years.

So far, the biggest thing I've not been able to replicate in any way is the #include compiler directive for AS2.

Has anyone found a solution to this problem?

Stuart Kemp
  • 150
  • 1
  • 11
  • Animations need to be coded manually, or at a bare minimum as a video displayed through the canvas, – QBM5 May 16 '16 at 15:18
  • @QBM5 Yeah, we're using createjs to tween objects in the animations, but historically we've wrapped the AS2 Tween functions in our own function names which are more friendly to our non-coding designer colleagues. We've also included other code, such as a hold function, so the designers can specify a number of seconds to wait on a given frame. – Stuart Kemp May 16 '16 at 15:25
  • It should be easy to add functionality to any Javascript API. It will of course depend on the API and how they manage objects and prototype chains but adding more descriptive naming and extending core functions is easy. Though a word of warning. If you delve into the API beyond the presented interface you are at risk of your code breaking due to internal changes that may or may not be announced. – Blindman67 May 16 '16 at 17:00
  • @Blindman67 Animate CC is a graphical editor with a code editor included, but the code is associated with frames of animation. I'm not looking for how to extend the API at delivery (ultimately being embedded in a webpage makes this easy) but how to replicate the behaviour in Flash and AS2 of including code at compile time, so that it is present in the test build without a coder manually adding it every time for our artists. – Stuart Kemp May 17 '16 at 12:06

1 Answers1

4

With the latest version of Animate CC (15.1.1.13) you can edit the HTML template used for publishing easily.

In the "Publish Settings" go to "Advanced" and export the default template. Open the exported HTML file and inject any additional JavaScript libraries after <!-- write your code here -->.

e.g. add <script src="http://code.jquery.com/jquery-2.2.3.min.js"></script> to use jQuery.

After saving the HTML file go back to "Publish Settings" and import your modified template with "Import New...".

You can use this approach with your own libraries and relative paths, just make sure they are available in the directory of the output file (same as .fla by default).

e.g. <script src="foo.js"></script>

Fabian
  • 335
  • 3
  • 15
  • Not as convenient as it used to be, but it's the best solution I've seen so far. – Stuart Kemp May 20 '16 at 13:46
  • This is the solution I'm going to use, but there is another question w/ a different solution - Basically adding code in Animate CC that loads in the files you want by appending them to the body. Here's a link: http://stackoverflow.com/questions/36807123/using-adobe-animate-cc-in-html5-canvas-mode-with-external-javascript-files – HungryBeagle Feb 06 '17 at 16:51