title: AS3 layer order
body: <p>I created two empty <strong>Sprites</strong> to serve as <strong>layers</strong>, bottom_spr and top_spr</p>
  
  <p>When clicking a button, a <strong>MovieClip</strong> appears and follows your mouse, untill you click, then its position is fixed.</p>
  
  <p>As soon as the button is clicked, I addChild the MovieClip to the correct Sprite.</p>
  
  <p>Unfortunately, the layer system doesn't see to work, because they are layered in the order I place them, the Sprites don't seem to influence it.</p>
  
  <p><strong>How is this possible?</strong></p>
  
  <pre><code>private var ground_spr:Sprite;
  private var units_spr:Sprite;
  
  public function Game() {
  addEventListeners();
  
  ground_spr = new Sprite();
  units_spr= new Sprite();
  
  addChild(ground_spr);
  addChild(units_spr);
  }
  
  private function addEventListeners(){
  groundBtn.addEventListener(MouseEvent.CLICK, clickGroundBtn);
  unitBtn.addEventListener(MouseEvent.CLICK, clickUnitBtn);
  }
  
  private function clickGroundBtn(event:MouseEvent){
      var ground = new Ground_mc();
  follow();
  ground_spr.addChild(ground);
  }
  
  private function clickUnitBtn(event:MouseEvent){
      var unit = new Unit_mc();
  follow();
  units_spr.addChild(unit);
  }
  </code></pre>