mardi 23 juin 2015

how to fix error #1009: Cannot access a property or method of a null object reference

hi im making my flash game this pops up when i test it i am new to flash so i have no idea how to fix it ive searched the web for 2 hours trying fix but no luck all help is appreciated so heres my code:

stop();
Quit.addEventListener(MouseEvent.CLICK, func55);

function func55(event:MouseEvent):void
{
    gotoAndStop(2);
    myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
    myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
}

Help.addEventListener(MouseEvent.CLICK, func49);

function func49(event:MouseEvent):void
{
    gotoAndStop(4);
    myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
    myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
}

var mytimer13:Timer = new Timer(2000,0);
mytimer13.addEventListener(TimerEvent.TIMER, timerListener10);
function timerListener10(e:TimerEvent):void {
Hungry_bar.scaleX-=0.05;
if(Hungry_bar.scaleX<=0.05){
        gotoAndStop(12)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}
myTimer.start();

var mytimer15:Timer = new Timer(3000,0);
mytimer15.addEventListener(TimerEvent.TIMER, timerListener12);
function timerListener12(e:TimerEvent):void {
Fun_bar.scaleX-=0.05;
if(Fun_bar.scaleX<=0.05){
        gotoAndStop(13)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}
myTimer2.start();

Feed.addEventListener(MouseEvent.CLICK,feed)
function feed11(e:MouseEvent){
    Hungry_bar.scaleX+=0.05
    if(Hungry_bar.scaleX>=1.5){
        gotoAndStop(14)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}

Fun.addEventListener(MouseEvent.CLICK,happy)
function happy11(e:MouseEvent){
    Fun_bar.scaleX+=0.05
    if(Fun_bar.scaleX>=1.5){
        gotoAndStop(15)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}

Aucun commentaire:

Enregistrer un commentaire