这是我一直试图从AS2转换的AS3卷轴。
我感谢你的帮助,但我仍然觉得'#error 1137不正确
参数数量'。如何让这个卷轴工作?
谢谢,
//SCROLLING GALLERY
addEventListener(Event.ENTER_FRAME, masterLoop);
function masterLoop(e:Event){
var mouseMin:int = 0;
var mouseMax:int = 0;
var BUTTON:Array = new Array();
BUTTON[0] = z1;
BUTTON[1] = z2;
BUTTON[2] = z3;
BUTTON[3] = z4;
BUTTON[4] = z5;
for(var i:int=0; i<5; i++){
var mouseX:int = 0;
if (mouseX > -360 && mouseX < 360)
{
mouseX = Math.ceil(mouseX);
}else{
mouseX = 20;
}
if (i<12){
var menuX:int = 0;
var menuX2:int = 0;
menuX = Math.ceil(BUTTON[i], x);
//menuX2 = Math.ceil(BUTTON[i+1], x);
}else{
//menuX2 = Math.ceil(BUTTON[0], x);
}
if (i < 12 && menuX2 > menuX){
BUTTON[i+1], x, menuX + 130;
}
if (mouseX < mouseMin && menuX < 1060) {
diff = (mouseMin-mouseX)/20;
BUTTON[i], x, (menuX+diff);
}else if (mouseX <= mouseMin && menuX >= 1060) {
diff = Math.ceil((mouseMin-mouseX)/15);
diff = diff + (menuX - 1060);
BUTTON[i], x, (-500 + diff);
}
if (mouseX > mouseMax && menuX > -500) {
diff = (mouseX-mouseMax)/20;
BUTTON[i], x, menuX-diff;
} else if (mouseX >= mouseMax && menuX <= -500) {
var diff:int = 0;
diff = Math.ceil((mouseMin-mouseX)/15);
diff = diff + (menuX + 500);
BUTTON[i], x, (1060 + diff);
}
}
}
答案 0 :(得分:1)
Math.ceil只接受一个参数。你将两个传递给它@:
menuX = Math.ceil(BUTTON[i], x);
答案 1 :(得分:1)
正如我在上一个问题的答案中所述,设置x
的{{1}}属性是这样的:
BUTTON[i]
不喜欢这样:
BUTTON[i].x = -500 + diff
修改强>
另请注意,您的行检查i&lt; 12将始终评估为真,因为我是0到5的计数器。
编辑2
另请注意,初始化数组的代码应该在EnterFrame事件处理程序之外,因为您不必在每个帧上重新初始化数组。