Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Can I embed an HTML Combobox component's JS code into the .FLA's code?

New Here ,
Oct 13, 2022 Oct 13, 2022

I may need to have a self-contained HTML file that isn't referencing external files and doesn't require the internet.

 

I have a combobox component in my scalable HTML canvas. The component references external JS files (jquery-3.4.1.min.js); (anwidget.js); and (combobox.js).
Is there any way in which I can copy all of the code from those files and past it into my Flash file's code, while keeping the combobox in working order?

 

Or would I have to edit the published HTML file and replace all references to those external JS files with their actual code? (I've done this with another file using createjs.min.js, but the file didn't have any components)

 

Thanks.

172
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2022 Oct 13, 2022

even easier, you can include files using the actions panel

 

kglad_0-1665678315957.pngexpand image

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2022 Oct 13, 2022

Thank you for the quick reply. I'm a JS novice and am trying to figure things out as I re-create them from AS3.

 

I have no custom external references.
The combobox component (widget?) references the external JS files on its own, after publishing to HTML. How would I force it to reference the JS code that I would paste into the Global Scripts panel? There are no built in component parameters available to do so.

This is the portion of the published HTML where the component references the JS files:
// library properties:
lib.properties = {
id: '',
width: 1200,
height: 830,
fps: 30,
color: "#FFFFFF",
opacity: 1.00,
manifest: [
{src:"https://code.jquery.com/jquery-3.4.1.min.js?1665679098055", id:"lib/jquery-3.4.1.min.js"},
{src:"components/sdk/anwidget.js?1665679098055", id:"sdk/anwidget.js"},
{src:"components/ui/src/combobox.js?1665679098055", id:"an.ComboBox"}
],
preloads: []
};

 

The published HTML also references this external JS file, which I'd like to force to use code in the global scripts panel if possible:

<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>

I've previously replaced this line with the actual full code, after publishing the HTML.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2022 Oct 13, 2022

the component js files are on your computer (after you publish in the relative folders indicated) and the createjs file can be downloaded and saved on your computer.  

 

you can then include them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2022 Oct 13, 2022

Yes, I've done that and it may work well enough.
Is there anyway to embed those scripts into the published HTML file when publishing from Animate, so the final file is just a single, self-contained HTML file that doesn't refernce local (or relative) files?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2022 Oct 13, 2022

yes, in the publish settings, click html/js > click include js in html

 

kglad_0-1665685563327.pngexpand image

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2022 Oct 13, 2022

I've had that option on and also tried checking on/off the "hosted libraries", but the HTML still references the JS files in a local (relative) folder called "libs" and another called "components" upon publishing from Animate.  I'll contine to play around with options and circle back.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2022 Oct 13, 2022
LATEST

yes, it's including only your project's js file in the html.  i'm not sure it adds included files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines