Reputation: 10163
I have a file called 1-DarknessScene.hx
which contains class DarknessScene
. When I try to reference this by creating a fully-qualified new com.foo.bar.scenes.DarknessScene()
, I get a class not found
error.
I double-checked the class/instance docs, but found no references to this behaviour.
Am I doing something wrong?
Upvotes: 0
Views: 225
Reputation: 6008
The section in the manual you are looking for is this:
http://haxeorg.dev/manual/type-system-modules-and-paths.html
In Haxe, each ".hx" file is called a module, and it can contain one or more classes, typedefs, enums, interfaces etc. A few points:
DarknessScene.hx
, rather than 1-DarknessScene.hx
.Scenes.hx
package mygame;
class Scene01Darkness {
// ...
}
And then import like this:
new mygame.Scenes.Scene01Darkness();
But the rules about class names (and I guess filenames) beginning with an upper case character still apply.
Good luck!
Upvotes: 1