removeBoid&中有错误删除列表中的1个

时间:2014-06-02 16:23:58

标签: android actionscript-3 flash

flock.removeBoids().中的

错误参数数量不正确。预期1 并且在 flock 中可能存在删除列表中的问题?

主要

if (e.target.hitTestObject( flock)) {
    dokkaebiIsHurt = true; // Show the crazy filters on the dokkaebi.
    // Start the timer, to eventually make the runner look like normal again.
    myTimer.start();
    //removeChild(flock);

            flock.removeBoid();
            score += 1; 
    updateTextFields();
    trace(score);
    e.target.removeEventListener(Event.ENTER_FRAME, moveArrow);
    removeChild(MovieClip(e.target));
    }

public function grun():void
    {
        for (var i:int = 0; i < ArrayList.length-1; i--)
        {
            //var b:Boid = Boid(ArrayList[i]);
            ArrayList[i].brun(ArrayList);
        }
    }

    public function removeBoid(b:Boid):void
    {
        //ArrayList.push(b);        
        ArrayList.splice(ArrayList.indexOf(b), 1);
        //removeChild(b);
    }

1 个答案:

答案 0 :(得分:2)

这非常简单 - 函数removeBoid采用一个参数 - b:Boid。你这样称呼它:flock.removeBoid();。你没有传递任何参数,所以有一个错误。

我很惊讶你是如何继续提问而不是自己寻求答案的!阅读一些编码基础知识,而不是每次代码中出现错误时询问问题。至少阅读错误说的内容!