Haxe - 找不到类:主类
Haxe - Class not found : Main
我第一次尝试使用haxe和鸡尾酒。我遵循本教程:http://www.silexlabs.org/haxe/cocktail/tutorials/getting-started-with-cocktail/
主.hx
import js.Lib;
import js.Dom;
class Main
{
static inline var ICON_COCKTAIL_PATH:String = "assets/icone_cocktail_blanche_ombre.png";
static inline var ICON_HAXE_PATH:String = "assets/icone_haxe_blanche_ombre.png";
static function main()
{
#if !js
//init cocktail and load the "index.html" file in the bin folder
cocktail.api.Cocktail.boot();
#end
//html and css loaded
Lib.window.onload = function(e) new Main();
}
public function new()
{
// get the image node
var image:Image = cast Lib.document.getElementById("icon");
// create interactivity
image.onmouseup = function(event:Event) {
// if image source is cocktail icon, change it to Haxe one
if (image.src.indexOf(ICON_COCKTAIL_PATH) != -1)
image.src = ICON_HAXE_PATH;
// if image source is not cocktail icon, change it back to cocktail
else
image.src = ICON_COCKTAIL_PATH;
}
}
}
编译.hxml
-main Main
-cp ../src
-js ../bin/Main.js
我有以下文件夹结构:
'Helloworld
'bin
'assets
'icone_cocktail_blanche_ombre.png
'icone_haxe_blanche_ombre.png
'app.css
'build
'src
'index.html
'Main.hx
'compile-js.hxml
但是当我尝试编译时:
haxe compile.hxml
Class not found : Main
谢谢
我认为你的compile.hxml应该看起来像这样。记下 src 文件夹的路径。我相信这与hxml文件位置有关。
-main Main
-cp src
-js bin/Main.js
相关文章:
- 气质的“nestRemoting()”有时可以'找不到关系
- Jquery 找不到双类名
- jQuery/can'我找不到避免代码添加类的方法
- 可以'似乎找不到并切换已经扩展的类
- jQuery在通过ajax调用返回的一些html中找不到类元素
- 找不到类 在电话间隙安卓中出现异常
- Haxe - 找不到类:主类
- 在函数之后找不到/未定义类名
- Ajax 调用返回“找不到类”错误,即使已定义数据库连接也是如此
- 找不到 cordova.exec 错误类
- 找不到phonegap错误类的pushwoosh插件
- Dojo DropDownMenu,找不到类
- Intellij可以'找不到.js文件(类搜索)
- 电子在主进程中需要node_modules:错误:找不到模块' linvodb3 '
- 在Babel中导出es6类-找不到模块
- Typescript类找不到"this"变量
- 用ajax发布变量时找不到类Yii
- 找不到id为pets_you_liked的类Pet的文档
- 在刚插入的HTML中找不到jQuery类的元素
- 计时器类-Can'找不到变量