Problem making classes for import

I am trying to convert from Actionscript 3 to OpenFL/Haxe. I have my own set of classes, each with the statement package melzie_utils. To use one of those classes I add an import melzie_utils._classname_ line in the class that will use it.

The melzie_utils are stored in a folder called _SharedScripts and I have added the line <source path="../_SharedScripts" /> to project.xml. This folder appears under Haxe Dependencies and I can open any of them from there.

In my Main.hx file I have a line import melzie_utils.ClearButton; and declare a variable of that type, var button:ClearButton;

When I do a build I get the error Type not found : melzie_utils.ClearButton

What do I need to look for?

Let’s imagine your directory structure looks like this:


  • _SharedScripts
    • melzie_utils
      • ClearButton.hx
  • TestProject
    • Assets
    • Source
      • Main.hx
    • project.xml

…then <source path="../_SharedScripts" /> in the “project.xml” file should work. Are you sure that “ClearButton” is in “_SharedScripts/melzie_utils/ClearButton.hx”?

I finally got it to actually import the class. Now I’m having probably with the syntax. There are differences between Actionscript and OpenFl that’s giving me problems, e.g. int has to be changed Int, public class -> class, etc.

I’ll start a different discussion for this.