Andre Angelo
Andre Angelo

Reputation: 281

TypeError: Error #1006: value is not a function

I have this code, but when I run it it gives me:

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

I don't understand why it is saying this, can someone enlighten me? The code is check if currentFrame is 2, if it is, then it runs start up and adds the main menu to the stage, from there, it adds Event Listeners to the buttons, here's the code:

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
        {

        }

    }

}

Let me know if you need more information, or if I forgot something.

Upvotes: 0

Views: 3873

Answers (1)

Andre Angelo
Andre Angelo

Reputation: 281

Sorry everyone, I just realized my dumb mistake, when I wrote:

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);

I didn't write .addEventListener. How dumb of me.

Upvotes: 2

Related Questions