Flash Error #1009: Cannot access a property oder eine Methode eines null-objektverweises ...?

Ich habe ein problem, wenn ich ein Menü erstellen mit flash as3. Könnt Ihr helfen was soll ich tun ...? Wie diese :

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DocumentClass/menuScreen()
at DocumentClass/mouseBack()

wie richtigen code zu beheben, den folgenden code:

package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.system.fscommand;
import flash.display.StageDisplayState;

public class DocumentClass extends MovieClip {
public var backbutton:BackButton = new BackButton();
    public function DocumentClass() {
        menuScreen();
        stage.addEventListener(Event.ENTER_FRAME, masukGame);

    }
    public function masukGame(e:Event):void{
        stage.displayState = StageDisplayState.FULL_SCREEN;
    }
    public function menuScreen():void{

        game.menuscreen.mb.addEventListener(MouseEvent.MOUSE_DOWN, mouseClick1);
        game.menuscreen.pb.addEventListener(MouseEvent.MOUSE_DOWN, mouseClick2);
        game.menuscreen.mlb.addEventListener(MouseEvent.MOUSE_DOWN, mouseClick3);
        game.menuscreen.kb.addEventListener(MouseEvent.MOUSE_DOWN, mouseClick4);


    }
    public function backMenu():void{

        backbutton.buttonMode = true;
        backbutton.addEventListener(MouseEvent.MOUSE_DOWN, mouseBack);
        backbutton.x = 450;
        backbutton.y = 400;
        //Dan akhirnya letakan button ke stage;
        addChild(backbutton);
        backbutton.visible=true;

    }

    public function mouseClick1(event:MouseEvent):void {
        game.gotoAndStop("MainGame");
        backMenu();


    }
    public function mouseClick2(event:MouseEvent):void {
        game.gotoAndStop("Petunjuk");
        backMenu();
    }
    public function mouseClick3(event:MouseEvent):void {
        game.gotoAndStop("Malaria");
        backMenu();
    }
    public function mouseClick4(event:MouseEvent):void {
        game.gotoAndStop("Keluar");
        backMenu();
    }
    public function mouseBack(event:MouseEvent):void {

        menuScreen();


    }   


    }
}

- Und das ist meine Datei, download hier: https://www.dropbox.com/s/jo7bcwnlfj7qjnh/My%20Game.rar

Bitte helft mir, und danke Jungs ...

InformationsquelleAutor Aditya Galang Mahafi | 2013-05-21

Schreibe einen Kommentar