我安装了Eclihx插件,我现在正在尝试测试它。 Main.hx的内容是
class Main {
static function main() {
trace("This is a test.");
}
}
,Build.hxml的内容是
-cp Source
# Uncomment the desirable target
# JavaScript target
-js Output/haxe Test.js
# SWF 9 target
-swf9 Output/haxe Test.swf
# ActionScript3 target
-as3 Output
# Neko target
-neko Output/haxe Test.n
# PHP target
-php Output
# C++ target
-cpp Output
# Uncomment and place your main class with package
-main Main
“项目”菜单中的构建选项显示为灰色。我该怎么办?
答案 0 :(得分:0)
首先,你不能一次编译所有目标,你需要评论所有目标并取消注释例如javascript目标。
然后,打开Haxe Package Explorer并选择(鼠标左键单击)您的项目(root),然后单击鼠标右键,Run As,Run Configurations ...
左键双击Haxe应用程序,您将获得New_configuration。选择项目,设置Build File,然后单击Run。您的项目已编译完毕。此外,您可以使用CTRL + 11编译项目。
现在,您需要为javascript目标测试html文档。在输出目录中创建test.html(生成.js文件)并使用如下内容:
<html>
<head><title>Haxe JS</title></head>
<body>
<div id="haxe:trace"></div>
<script type="text/javascript" src="hxTest.js"></script>
</body>
</html>
对于Neko,我通常将.n扩展名与Neko程序等相关联(然后你只需要点击.n来执行你的程序)
提示:项目属性,Haxe内容辅助,构建文件(从项目中选择build.hxml)以启用代码完成。