title: Why is my override protected function createChildren being ignored?
body: <p>Here is the error:<pre>
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at view::ScoreBoard/setChipCount()[C:\Flex Builder 3\StackOverflowQuestion\src\view\ScoreBoard.as:32]
          at model::MainDeckScoreBoard()[C:\Flex Builder 3\StackOverflowQuestion\src\model\MainDeckScoreBoard.as:21]
          at model::MainDeckScoreBoard$cinit()
          at global$init()[C:\Flex Builder 3\StackOverflowQuestion\src\model\MainDeckScoreBoard.as:5]
          at main()[C:\Flex Builder 3\StackOverflowQuestion\src\main.mxml:13]
          at _main_mx_managers_SystemManager/create()
          at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3188]
          at mx.managers::SystemManager/<a href="http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C" rel="nofollow noreferrer">http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C</a>:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3064]
          at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2916]</pre></p>
  
  <p>Here is main.mxml:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
      &lt;mx:Application
          xmlns:mx="http://www.adobe.com/2006/mxml"
          creationComplete="initApp()"
      &gt;
          &lt;mx:Script&gt;
              &lt;![CDATA[
                  import model.MainDeckScoreBoard;
  
                  public var _mainDeckScoreBoard:MainDeckScoreBoard = MainDeckScoreBoard.instance;
  
                  private function initApp():void {
                      this.addChild(_mainDeckScoreBoard);
                  }
              ]]&gt;
          &lt;/mx:Script&gt;
      &lt;/mx:Application&gt;
  </code></pre>
  
  <p>Here is MainDeckScoreBoard.as:</p>
  
  <pre><code>package model {
      import view.ScoreBoard;
  
      [Bindable]
      public dynamic class MainDeckScoreBoard extends ScoreBoard {
  
          /** Storage for the singleton instance. */
          private static const _instance:MainDeckScoreBoard = new MainDeckScoreBoard( SingletonLock );
  
          /** Provides singleton access to the instance. */
          public static function get instance():MainDeckScoreBoard {
              return _instance;
          }
  
          public function MainDeckScoreBoard( lock:Class ) {
              super();
              // Verify that the lock is the correct class reference.
              if ( lock != SingletonLock ) {
                  throw new Error( "Invalid Singleton access.  Use MainDeckScoreBoard.instance." );
              }
              this.setChipCount("0");
          }
  
      } // end class
  } // end package
  
  class SingletonLock {
  } // end class
  </code></pre>
  
  <p>Here is ScoreBoard.as:</p>
  
  <pre><code>package view {
      import mx.containers.HBox;
      import view.ScoreBoardLabel;
      import view.ChipCountContainer;
      import view.CardRankList;
  
      public dynamic class ScoreBoard extends HBox {
  
          /** The chip count. */
          public var _chipCount:ChipCountContainer;
  
          public function ScoreBoard() {
  
              super();
  
              this.width = 489;
              this.height = 40;
              this.setStyle("horizontalScrollPolicy", "off");
          }
  
          override protected function createChildren():void {
  
              super.createChildren();
  
              if(!_chipCount) {
                  _chipCount = new ChipCountContainer();
                  this.addChild(_chipCount);
              }
          }
  
          public function setChipCount(labelText:String):void {
              _chipCount._chipCountLabel.text = labelText;
              invalidateDisplayList();
          }
      }
  }
  </code></pre>
  
  <p>Here is ChipCountContainer.as:</p>
  
  <pre><code>package view {
      import mx.containers.Canvas;
  
      public dynamic class ChipCountContainer extends Canvas {
  
          /** The label. */
          public var _chipCountLabel:ChipCountLabel;
  
          public function ChipCountContainer() {
  
              super();
  
              this.width = 20;
              this.height = 20;
          }
  
          override protected function createChildren():void {
  
              super.createChildren();
  
              if(!_chipCountLabel) {
                  _chipCountLabel = new ChipCountLabel();
                  this.addChild(_chipCountLabel);
              }
          }
      }
  }
  </code></pre>
  
  <p>I've methodically moved things around and waved the invalidate Display List incense while performing a create Children dance but I've only succeeded in completely confusing myself. I've searched the Flex libraries for similar constructions, and it looks OK to me, but I guess I'm just not getting the concept.</p>