I have a haxe project which used the other one ( i.e import classes from the first one ) . At the second OpenFL project I use this before
<source path="../CommonLib/src"/> in project.xml file to import the source code.
At the last Lime (5.4.0) and OpenFL ( 6.1.0) this doesn’t work.
Is there other way to import haxe source into the other openfl project ? ( I know if create it as haxelib probably will work)
That should work. Do you get an error message, or do you just not get access to your code? The path should be relative to your project root directory, the same as your project file
Not have any errors. The second project compile , but nothing happens ( i.e I set trace log and also add breakpoint , but all is ignore and not see trace at all. When comment the line ( and set only trace in Main) everything works )
I wrote a simple test locally to double check this functionality, but it’s working fine. Perhaps there’s another issue – do you have the same class name in multiple source paths? Perhaps one is overriding the other? What target are you using?
For sanity, you could try adding a
public static var test = "HELLO"; to one of the CommonLib classes, and trace that first thing in the constructor of your other project, just to be sure your reference is working
I just create two projects : MainTest and CommonLib
I run MainTest project in debug mode ( flash target) and expect to see log info. Also add breakpoint. MaintTest project include CommonLib with the tag in project.xml
I’m using HaxeDevelop as IDE , but can’t see any log info and also breakpoint not work.
Here is the project:
Does it work from the command-line? (
openfl test flash or
openfl test neko)
No. Same result. I make again quick check and remove < source path="… " > and put trace on to MainTest project and all works ( on command-line) and via HaxeDevelop. I’m running on Win 10
Thanks for the sample! This was confusing
Your project has two source tags:
<source path="src" />
<source path="../CommonLib/src" />
The second takes precedence over the first in case they both define the same class. In fact, they both define
Main.hx, which means your project uses the “CommonLib”
Main.hx – that’s why it doesn’t print anything!
I think you really want:
<source path="src" />
<source path="../CommonLib" />
(based on your current file structure)