Note that there are some explanatory texts on larger screens.

plurals
  1. POError #1009: Cannot access a property or method of a null object reference. -AS3
    text
    copied!<p>i got this error:</p> <pre><code>TypeError: Error #1009: Cannot access a property or method of a null object reference. at TriviaGameDeluxe/saveScore()[TriviaGameDeluxe::frame102:19] </code></pre> <p>This is my code:</p> <pre><code>//**// playAgainbutton.addEventListener(MouseEvent.CLICK,saveScore); function saveScore(event:MouseEvent) { // Save the score if (savedSN == null) { // Check if a game save is created. If it is not, create one trace("New game save created"); savedSN = { // Set the varible 'savedSN' name1:"-", name2:"-", name3:"-", name4:"-", score1:"-", score2:"-", score3:"-", score4:"-"}; soSavedScNa.data.nameScore = savedSN; // Set the data in the save file to the savedSN variable soSavedScNa.flush(); // Overwrite existing save file } //**// Save the score if ((gameScore &gt; savedSN.score1 || savedSN.score1 == "-") &amp;&amp; gameScore != 0) { trace("Score 1"); savedSN = { // Set the date the savedSN varible will have name1:PName.text, name2:savedSN.name1, name3:savedSN.name2, name4:savedSN.name3, score1:gameScore, score2:savedSN.score1, score3:savedSN.score2, score4:savedSN.score3}; soSavedScNa.data.nameScore = savedSN; // Set the data in the save file to the savedSN variable soSavedScNa.flush(); // Overwrite existing save file playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP, saveScore); cleanUp(); gotoAndStop(1); // Go to the start menu } else if ((gameScore &gt; savedSN.score2 || savedSN.score2 == "-") &amp;&amp; gameScore != 0) { trace("Score 2"); savedSN = { // Set the date the savedSN varible will have name1:savedSN.name1, name2:PName.text, name3:savedSN.name2, name4:savedSN.name3, score1:savedSN.score1, score2:gameScore, score3:savedSN.score2, score4:savedSN.score3}; soSavedScNa.data.nameScore = savedSN; // Set the data in the save file to the savedSN variable soSavedScNa.flush(); // Overwrite existing save file playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP, saveScore); cleanUp(); gotoAndStop(1); // Go to the start menu } else if ((gameScore &gt; savedSN.score3 || savedSN.score3 == "-") &amp;&amp; gameScore != 0) { trace("Score 3"); savedSN = { // Set the date the savedSN varible will have name1:savedSN.name1, name2:savedSN.name2, name3:PName.text, name4:savedSN.name3, score1:savedSN.score1, score2:savedSN.score2, score3:gameScore, score4:savedSN.score3}; soSavedScNa.data.nameScore = savedSN; // Set the data in the save file to the savedSN variable soSavedScNa.flush(); // Overwrite existing save file playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP, saveScore); cleanUp(); gotoAndStop(1); // Go to the start menu } else if ((gameScore &gt; savedSN.score4 || savedSN.score4 == "-") &amp;&amp; gameScore != 0) { trace("Score 4"); savedSN = { // Set the date the savedSN varible will have name1:savedSN.name1, name2:savedSN.name2, name3:savedSN.name3, name4:PName.text, score1:savedSN.score1, score2:savedSN.score2, score3:savedSN.score3, score4:gameScore}; soSavedScNa.data.nameScore = savedSN; // Set the data in the save file to the savedSN variable soSavedScNa.flush(); // Overwrite existing save file playAgainbutton.removeEventListener(MouseEvent.MOUSE_UP, saveScore); cleanUp(); gotoAndStop(1); // Go to the start menu } } </code></pre> <p>I cannot find where the error is.. Hope anybody can help. Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload