I just started trying out Haxe to make a web-app, and I would like to use CreateJS, which has a Haxe extern lib thingy. I\'m using FlashDevelop as my IDE.
So I creat
Ok I played around a bit more with the maps and now it's fixed, here's how it looks now:
If anyone has some more info about externs, and how they work, this would still be appreciated!
Thanks
The way Haxe externs usually work is:
You include the original Javascript manually*. In your case, you add the tags pointing to the CreateJS javascript ( into your HTML file.
The 'extern' files are used so that Haxe knows the other files are there, and knows what methods can be called, properties changed etc. It also helps keep the auto-complete fully functional and useful.
If the externs are kept in a library, you need to install that library (haxelib install createjs
) and then you need to include that library in your build. I do this by adding -lib createjs
to the hxml build file. Flash Develop can do this by opening Project->Properties->Compiler Options
and adding "createjs" to the Libraries list.
In your Haxe file, you use the "include" statements, like you have above.
From your description above, I think you're missing the bit in step 3 where you include the library. I'm not a Flash Develop user, so I'm not sure if it's different at all, but it looks like in your follow up answer you've copied some of the *.hx files from the 'createjs' haxelib, just enough to make it compile. If you add the '-lib createjs' line to your hxml build file though, you shouldn't need these anymore.
Hope this helps you get started, let me know if you get stuck and I'll try update my answer.
(*) an exception to this is some libraries include the Javascript for you. An example is when you use js.JQuery in the Haxe standard library - this includes the raw javascript for you. Most libraries you'll have to add the scripts yourself though.
(Edit: added instructions for adding libraries in Flash Develop thanks to comment)
In FD goto Project->Properties then to the Compiler Options tab there you can add each required lib you installed with haxelib and don't need to copy the lib source into your project source tree. This will only be useful in case you need to modify the lib.