9 Replies Latest reply on Nov 7, 2007 5:15 PM by "B"

    AS3... Stopping the download of an external file (removeEventListener???)

    "B" Level 1
      On my stage, I have three buttons each of which is used to load an external swf file onto the stage (via an emtpy movie clip). I have an addEventListener that calls a function that adds the swf file to the stage using the addChild method. This function is called on Event.COMPLETE (when the external movie finishes downloading)

      When testing the master file, I'm using Simulate Download so that I can monitor the download progress (I have a preloader on the stage that displays percent loaded, etc). So let's say I click on the third button which begins loading movieC. I then change my mind halfway through the download process of movieC and decide I want to see movieA. So I click on the first button. But what ends up happening is that both movies are still going through the download process (though the preloader is accurately only reporting information about the newest movie that's downloading). The reason why I know that movieC is still downloading is that it will show up on my stage while movieA is still downloading. When movieA finally finishes downloading and shows up on the stage, then movieC will go away. (As a side note: how movieC gets removed once movieA shows up is beyond me because I'm not using removeChild and I thought that without removing the child, external movies will just stack right on top of one another. ??)

      I am not sure how to kill the download/display of the movie that's loading from when I clicked on the third button (movieC). I have tried using removeEventListener but it's not working. I suspect that you can't remove a listener while it's monitoring something. Perhaps it can only be removed once the event is complete? If that's the case, how in the heck do I stop another movie from downloading/displaying should I change my mind and click another button to view a different movie?

      I hope this all makes sense. I'm so tired after hours of working on this file that I can't tell the ceiling from the floor at this point. Oh, and my hair fell out 2 hours ago. Or maybe I pulled it out.

      Any help would be appreciated.