title: Delete specific image from loader
body: <p>I have three images all from the same loader on screen. I need to delete a specific (targeted) bitmap once clicked. I have an onClick function below, any help is greatly appreciated. Thanks!</p>
  
  <pre><code>var nb_images:int = 3;
  
  var bmp:Bitmap = new Bitmap;
  
  var img_margin:int = stage.stageHeight/3.5;
  var img_request:URLRequest;
  var img_loader:Loader;
  
  var images_container:Sprite = new Sprite();
  addChild(images_container);
  
  function remove_all_images():void {
      for (var i:int = images_container.numChildren - 1; i &gt;= 0; i--) {
          images_container.removeChildAt(i);
      }
  }
  
  function load_images():void {
      remove_all_images();
      for (var i:int = 0; i &lt; nb_images; i++) {
          img_request = new URLRequest('../img/planet' + (int(nb_images * Math.random())) + '.png');
          img_loader = new Loader();
          img_loader.load(img_request);
          img_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_img_loaded);
      }
  }
  
  function on_img_loaded(e:Event):void {
      e.currentTarget.removeEventListener(Event.COMPLETE, on_img_loaded);
      bmp = e.currentTarget.content;
      bmp.x = 600, bmp.width = bmp.height = 80;
      bmp.y = images_container.numChildren * (bmp.height + img_margin);
      images_container.addChild(bmp);
      stage.addEventListener(MouseEvent.CLICK, onClick);
      function onClick(event:MouseEvent):void {
          removeChild(e.target);
      }
  }
  
  load_images();
  </code></pre>