title: unload external swf (child) from the main screen when it has reached last frame?
body: <p>I have an external swf loading into a main frame (the URL request), and when the swf reaches it's final frame I need it to UNLOAD itself. I need to do this without any code on the CHILD swf, as this is for an iOS application. Can anyone help?</p>
  
  <pre><code>//start button
  
  start_button_aboriginal.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);
  
  import fl.display.ProLoader;
  var fl_ProLoader_3:ProLoader;
  
  //This variable keeps track of whether you want to load or unload the SWF
  var fl_ToLoad_3:Boolean = true;
  
  function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
  {
  if(fl_ToLoad_3)
  {
      fl_ProLoader_3 = new ProLoader();
      fl_ProLoader_3.load(new URLRequest("myths/myth_aboriginal.swf"));
      addChild(fl_ProLoader_3);
      fl_ProLoader_3.x = 114;
      fl_ProLoader_3.y = 41;
  }
  else
  {
      fl_ProLoader_3.unload();
      removeChild(fl_ProLoader_3);
      fl_ProLoader_3 = null;
  }
  // Toggle whether you want to load or unload the SWF
  fl_ToLoad_3 = !fl_ToLoad_3;
  
  //here, I want to UNLOAD the external SWF when it is finished playing.
  
  var totFrames:Number=childMC.totalFrames;
  var curFrame:Number;
  
  childMC.addEventListener(Event.ENTER_FRAME, remove);
  
      function remove(evt:Event):void {
      curFrame=childMC.currentFrame;
      if (totFrames==curFrame) {
          removeChild(childMC);
      }
  }
  </code></pre>