2

We are converting several thousand .FLA files from SWF (Flash CS6) to HTML5 Canvas (Animate CC format). I have already written a JSFL script that automates the process:

  • Converts Compiled Clips to HTML5-friendly objects
  • Converts document to HTML5 Canvas format
  • Associates a new Publish Profile and HTML template with the document
  • Changes the publish filenames

So, the hard part is done! But I want to optimize it a bit more.

The current HTML template has some shared utility functions. The utility functions add 5-10kb to the file size of each animation, which themselves are probably in the 20-50kb range.

I would rather include these utility functions by setting a Global Include script, going to the top-left of the Actions panel, selecting Include, and adding a script with the + key. (When I'm done, it will show the URI underneath Global Script)

This produces the output I want, and it's perfect! The only downside is, I have to do this manually -- I'd like a way to associate the .JS file as a Global Include when running my JSFL conversion script.

Does anyone know of a JSAPI method to retrieve or set a Global Include script in HTML5 Canvas documents?

I haven't been able to find any documentation on such a function in JSFL/JSAPI. It doesn't seem like setting the scripts leaves a trace in the History pane, so I'm at a loss here.

Dre G
  • 56
  • 6
  • Not directly; I wasn't able to find where Global Includes are accessed in JSFL. Instead, I moved the utility functions out of the html template into a separate .js file. And then created a link from the html template to that .js file. My automation script copies said .js file into the publish folder, that way all the files can share it. It's a little bit more file management but it gets the job done. – Dre G May 11 '19 at 01:45
  • 1
    FWIW, I think there's *still* no way to do this through the JSFL (they haven't really kept the API up to date, it seems). I ended up using something like AutoHotkey to click the menu., but looking back, a cleverer way may have been to alter the default template or add some code in frame 0 to load the script into the DOM at runtime. – General Grievance Dec 06 '21 at 16:43

0 Answers0