开发者

AS3, scroller #1137 error

This is an AS3 scroller I've been trying to convert from AS2.

I appreciate the help, but I'm still getting '#error 1137 incorrect number of arguments'. How do I get this scroller to work?

Thanks,

//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开发者_JAVA技巧 > 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);
        }
    }
}


As I stated in the answer to your previous question, setting the property x of BUTTON[i] is done like this:

BUTTON[i].x = -500 + diff

NOT like this:

BUTTON[i], x, (-500 + diff);

EDIT
Also note, your lines checking for i < 12 will always evaluate to true since i is a counter from 0 to 5.

EDIT 2
Also note, your code initializing your array should be outside of the EnterFrame event handler as you are needlessly reinitializing the array on each frame.


Math.ceil only takes one argument. You are passing two into it @:

menuX = Math.ceil(BUTTON[i], x);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜