0

我有这段代码,但是当我运行它时,它给了我:

TypeError: Error #1006: value is not a function.
    at Main/startUp()
    at Main/refresh()

我不明白为什么会这样说,有人可以启发我吗?代码检查 currentFrame 是否为 2,如果是,则运行启动并将主菜单添加到舞台,然后将事件侦听器添加到按钮,代码如下:

package 
{
    import flash.display.MovieClip;
    import flash.display.StageQuality;
    import flash.events.Event;
    import flash.events.MouseEvent;

    /**
     * ...
     * @author Andre
     */
    public class Main extends MovieClip 
    {
        var toStart:Boolean = true;
        public function Main()
        {
            stage.addEventListener(Event.ENTER_FRAME, refresh);
        }

        function refresh(e:Event):void 
        {
            if (this.currentFrame == 2 && toStart == true)
            {
                startUp();
                toStart = false;
            }

        }

        function startUp():void
        {
            var startScreen:lstartScreen = new lstartScreen();
            addChild(startScreen);
            //startScreen.startScreen_play.addEventListener(MouseEvent.CLICK, startGame)
            startScreen.startScreen_quality.startScreen_quality_high(MouseEvent.CLICK, changeQuality);
            startScreen.startScreen_quality.startScreen_quality_medium(MouseEvent.CLICK, changeQuality);
            startScreen.startScreen_quality.startScreen_quality_low(MouseEvent.CLICK, changeQuality);
        }

        function changeQuality(e:MouseEvent):void
        {

        }

    }

}

如果您需要更多信息,或者我忘记了什么,请告诉我。

4

1 回答 1

2

对不起大家,我刚刚意识到我的愚蠢错误,当我写道:

startScreen.startScreen_quality.startScreen_quality_high(MouseEvent.CLICK, changeQuality);
startScreen.startScreen_quality.startScreen_quality_medium(MouseEvent.CLICK, changeQuality);
startScreen.startScreen_quality.startScreen_quality_low(MouseEvent.CLICK, changeQuality);

我没有写 .addEventListener。我多么愚蠢。

于 2012-08-25T01:53:59.890 回答