actionscript 3 - AS3 Error 1009 null object -


i have no idea why keeps saying error 1009!?

here code

    import flash.events.event;      var mysound:sound = new avondbos();      var channel1:soundchannel = mysound.play();       start.addeventlistener (mouseevent.click, veeg);     start.buttonmode = true;      function veeg (e:event):void     {         maan.gotoandplay("2");         start.gotoandplay("2");         headphone.gotoandplay("2");         rupsje.gotoandplay("2");     }      maan.land.blad.addeventlistener (mouseevent.click, klikblad);     maan.land.blad.buttonmode = true;      function klikblad(e:event):void     {         if (maan.land.blad.currentframelabel == "halfblad")         object(root).gotoandstop(1, "cocon2");     }      maan.land.blad.addeventlistener (mouseevent.click, klikblad2);      function klikblad2(e:event):void     {         maan.land.blad.gotoandplay("130");         rupsje.gotoandplay("293"); }     

the error:

typeerror: error #1009: cannot access property or method of null object reference. @ project_550690_robin_janssen_fla::maintimeline/klikblad2() 

can't figure out wrong , flash not helping either.

thanks in advance,

robin

error 1009 occurs when you're trying access doesn't exist.

so when user clicks, moves frame, if user clicks again won't able execute because code won't exist anymore. error that's being returned can see you're program trying access function 'klikblad2()' when doesn't exist on frame (but frame on).

i recommend adding:

whateverthetargetis.removeeventlistener(mouseevent.click, eventnamehere); 

to end of functions go frame code won't be. solve problem because won't listening clicks anymore meaning won't try access non-existing (on frame anyway) functions; won't return errors.

sorry if seems complicated or hard understand, if you're still confused.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -