Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With only that code, it must be either page, or page.Text, is null.</p> <p><strike>Going by the names, I would guess page is a Flash library object you create with AS? If so, I would guess a previous error is firing before it is created and being swollowed by the player (can happen if the debugger has not attached yet, or problems with loading shared librarys). 'stage' not being set for new display object until it's added to the display list is common.</strike></p> <p>EDIT: It's a bug in the component: <code>draw()</code> always uses the <code>highScoresModuleText</code> property on page: which is only set when the page is a <code>HighScoresTextPage</code>, and not any of the other pages, eg: <code>HighScoresTablePage</code>, which <code>showHighsSores()</code> sets it to. This works in Flash presumably because the object is on the stage, or at least gets created before <code>showHighScores()</code> is called, so <code>draw()</code> gets called first, and since the component does not invalidate, is not called after.</p> <p>The correct method in this case is to have <code>show*()</code> just set some properties, then <code>invalidate()</code> to have <code>draw()</code> figure it out later, but a quick fix is to just add '<code>if (page.highScoresModuleText)</code>' around the offending lines in <code>draw()</code>. An even quicker fix is to create and <code>addChild()</code> the component early (like startup), and call <code>showHighScores()</code> much later.</p> <p>This works for me:</p> <pre><code>package { import flash.display.Sprite; import com.novelgames.flashgames.highscores.HighScores; import flash.events.MouseEvent; public class As3_scratch extends Sprite { private var highscore : HighScores; public function As3_scratch() { highscore = new HighScores(); addChild(highscore); stage.addEventListener(MouseEvent.CLICK, onClick); } private function onClick(event : MouseEvent) : void { highscore.showEnterHighScore(50); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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