I noticed the support for AS3 via Royal for OpenFL and thought I’d take a look at how easy it’d be to port over a project we’ve had in flash for years. Our project uses SVG extensively so I tried to modify the BunnyMark example to load an svg file but ran into issues. I was trying to import this library for handling the svg loading:
In the BunnyMark demo I first did an
and confirmed it ran - then I added the import statement:
and imported the library with:
npx haxelib install svg
but was unable to get it recognized. When running “npm start” I keep getting
Warning: Definition format.SVG could not be found.
Is there a way to import this library for use with as3 and openfl?
Doing some research I think I understand further.
When using the npm version of OpenFL - you’ll have to add libraries from npm. Meaning the libraries you would normally use via haxe would need to be registered and updated for npm with an appropriate package.json and definitions file so that it could be seen from a) your NPM created project and b) the definitions need to exist to see it from within your as3 project code.
Short answer - The SVG library does not have an npm entry currently so it’s not able to be added to your OpenFL for NPM project
For reference look at this discussion with @SingMajesty on using external libraries in OpenFL for NPM:
The thread goes on to explain how the actuate library in the PiratePig example was able to be used because it was added to NPM
I’m going to try using OpenFL for haxelib for my purposes. It still can target html5 and many of the libraries are already available.