我正在写Haxe并以Neko为目标.今天我遇到了这个问题:
var a:Array<Array<Int>> = new Array<Array<Int>>();
a[1] = [1, 2, 3];
Run Code Online (Sandbox Code Playgroud)
第二行抛出"无效的数组访问"异常.也不可能像这样迭代行:
for (i in a[0]) ...
Run Code Online (Sandbox Code Playgroud)
像这样的代码总是运行正常,但不是今天的代码.这可能是什么问题?我试图访问的单元格和行保证存在(如果谈论索引).
我正在使用 Adobe Animate 为我的游戏绘制资源,但是,精灵的不同部分之间会出现小间隙。如何修复它?
它在 Adobe Animate 中的显示方式与在游戏中的显示方式的比较:


class Main extends Sprite
{
public function new()
{
super();
try
{
var xml:Xml = Xml.parse("<count>6</count>");
trace(xml.nodeType);
for (x in xml.elementsNamed("count"))
{
trace(x.nodeName);
trace(x.nodeType);
trace(x.nodeValue);
}
}
catch (err:Dynamic)
{
trace(err);
Sys.exit(1);
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
Main.hx:23:6
Main.hx:27:tount
Main.hx:28:0
Main.hx:34:节点类型错误,意外0
我不能完全理解nodeValue财产的运作原则.因此,我无法解决我的问题.这里有什么帮助?
PS我的配置是:Haxe + OpenFL瞄准Neko.