Integrating Javascript libraries, like GSAP

Hi, I was wondering which is the best way to integrate javascript libraries into OpenFl.
I am sincere, I don’t know any but I know it is possible :wink:
I read about extern and untyped, but always from old resources. HaXe and OpenFl is evolving, so I’d like to have updated explanations.

In particular I am interested in GSAP, Greensock tweening system, because I’d like to introduce in our workflow new/alternative tools, as familiar as possible, because we were been using AS3 + GSAP since 2009. Just an example.

1 Like

This is probably the most up-to-date explanation using JQuery as an example: http://haxe.org/manual/target-javascript-external-libraries.html

1 Like

Thank you! I will dive into it.

You can also use the <dependency path="" /> tag to add an additional JavaScript file when publishing to the HTML5 target, if needed

Please can you give an example?

This could go in a project.xml (for a project), or in an include.xml (for a haxelib)

It will copy and link the JavaScript file when publishing to HTML5, you still need extern classes but this helps when you need to include an additional external script

2 Likes

I need to understand how to create externs and use them…

It’s kind of like an interface

http://old.haxe.org/doc/js/extern_libraries

Yes, I have read something about it but I have to go more in depth.

Can this approach be used for just including for instance a css/ folder ? I’m looking for a simple way to copy folders into export.

Never mind.
<assets path="templates/html5/css" rename="css" embed="false" />

Seems to be the way to go.