# Unloading movie clip in flex

**URL:** <https://forum.kirupa.com/t/unloading-movie-clip-in-flex/301867>\
**Category:** flash\
**Created:** [December 17, 2009, 2:30am UTC](https://forum.kirupa.com/t/unloading-movie-clip-in-flex/301867 "2009-12-17T02:30:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AzureRain](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@AzureRain](https://forum.kirupa.com/u/AzureRain)\
**Post date:** [December 17, 2009, 2:30am UTC](https://forum.kirupa.com/t/unloading-movie-clip-in-flex/301867/1 "2009-12-17T02:30:00Z")

</div>

Hi,

I’m using Flex to load external swfs, and casting them as movie clips so I can communicate with them. However, I’m having difficulty unloading the movieclip. I’ve tried setting loaded\_MC = null, but it still continues to run in the background.

public var loaded\_MC:MovieClip;

private function init():void  
{  
loaded\_MC = MovieClip(swfLoad.content);  
swfLoad.addEventListener(Event.ENTER\_FRAME, unloader);  
}

```
        private function unloader(event:Event):void
        {
            if(!show)
            {
                swfLoad.removeEventListener(Event.ENTER_FRAME, unloader360);
                swfLoad.unloadAndStop(true);
                
            }
        }

```

\<mx:SWFLoader id=“swfLoad” complete=“init()” /\>
