TypeError:错误#1006:value不是函数

时间:2012-08-25 01:38:28

标签: actionscript-3 flash actionscript

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

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
        {

        }

    }

}

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

1 个答案:

答案 0 :(得分: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。我多么愚蠢。