4 Replies Latest reply on Oct 4, 2010 1:25 PM by learner_doug

    Unload SWF

    learner_doug Level 1

      I have an application that loads a swf using the SWFLoader.  I can't seem to get it unloaded.



      1.  State1 - user clicks on some text with a click handler and is taken to State2

      2.  State2 is a component called by the "main" application which includes a


           SWFLoader ...source="example.swf" id="swfLoader_ID"...


      3.  State 2 of the main applicatino has a "skip" button that should unload the example.swf.  I use




      which works fine in other situations, but not in this one.  Any help is apprecitaed.



        • 1. Re: Unload SWF
          jgomer2001 Level 1

          I don't know if this could be useful for you but here it goes: once I had to load a SWF (a video) and use the Loader class.  i had a reference to that loader class and I called the unload method, however, the video was still playing though it disappeared from stage,  what I had to do was "removing" all references to loader, for example, making that global variable (of type Loader) into a simple local variable in a method, that way, as the SWF had no references, I could solve the problem.


          Hope that helps. Think of that part ... removing references ...







          • 2. Re: Unload SWF
            Flex harUI Adobe Employee

            Use the profiler to see what is holding onto the SWF.

            1 person found this helpful
            • 3. Re: Unload SWF
              learner_doug Level 1

              Thanks for your experience.  I also had that problem (unloaded the loader, but was still playing in the background).


              I was able to solve in yet another way:  unloadAndStop() - that seems to get rid of the whole thing.


              This problem is a bit different in that I can't even seem to reference the loader at all.  Another person recommended that I use the profiler, so I'll give that a try (providing I have a profiler).


              Thanks much!


              • 4. Re: Unload SWF
                learner_doug Level 1

                I think I'm going to change the way I load this SWF - mainly by not using states.  I was using states

                because I was used to page-based applications, however, I think that Flex states are not good to use for loading and unloading external SWFs - at least not in my case.  I'm probably going to go back to having just one state until I understand states better, or have a simpler application.