[英]Haxe - Error #1006: insert is not a function
Starting to work with Haxe compiling to a Flash swc file, it is advised not to use the Array 'insert' in loops or if statements. 开始使用Haxe编译为Flash swc文件时,建议不要在循环或if语句中使用数组“插入”。 I have this code, which requires using loops and if statements 我有这段代码,需要使用循环和if语句
if (coa[8] > 0){
for (ip in 0...s1.length){
if (s1[ip] == "*"){if (s1[ip-2] <= 0 || s1[ip-2] > 0){if (s1[ip-1] <= 0 || s1[ip-1] > 0){
var t1 = ip-2;var t2 = (ip-2)*(ip-1);
s1.insert(t1,t2);s1.splice(ip-2,3);
coa[8]--;
}}};
} // loop ip
}
The swc file compiles without error but when I plug it into the Flash CC (2014) IDE and test I get the following error swc文件编译没有错误,但是当我将其插入Flash CC(2014)IDE并进行测试时,出现以下错误
Error #1006: insert is not a function.
at Haxe2D/execute()
The arrays are dynamic which could be why the swc compiles without registering an error. 数组是动态的,这可能就是为什么swc编译时不会注册错误的原因。
Is there a solution to this? 有针对这个的解决方法吗?
It sounds like you didn't call haxe.initSwc(mc);
听起来您没有调用haxe.initSwc(mc);
before running your code. 在运行代码之前。
It is required as stated at http://old.haxe.org/manual/swc . 如http://old.haxe.org/manual/swc所述,它是必需的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.