# Load (on rollover) and unload (on roll off) swf's

**URL:** <https://forum.kirupa.com/t/load-on-rollover-and-unload-on-roll-off-swfs/312884>\
**Category:** Uncategorized\
**Created:** [August 15, 2010, 5:10am UTC](https://forum.kirupa.com/t/load-on-rollover-and-unload-on-roll-off-swfs/312884 "2010-08-15T05:10:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuma\_jon](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@kuma\_jon](https://forum.kirupa.com/u/kuma_jon)\
**Post date:** [August 15, 2010, 5:10am UTC](https://forum.kirupa.com/t/load-on-rollover-and-unload-on-roll-off-swfs/312884/1 "2010-08-15T05:10:41Z")

</div>

Hi all,

Sorry - I know this is something I should’ve been able to find through a search, but didn’t actually turn anything up. If someone wouldn’t mind lending me a quick hand (or pointing me in the right direction).

\> I have a map which has about 5 or 6 points on it  
\> each point needs to load an external swf into a movie clip (is that still the same in AS3?) when a user hovers over the point, then unload it when a user moves their mouse off  
\> finally, if someone clicks on a point, it will take them to another page

At the moment, I’m able to load it on rollover, but then it doesn’t disappear when I move my mouse off the point (and I’m not really having much luck with linking the …my current AS3 is:

=========================

var swf1Request:URLRequest = new URLRequest(“new.swf”);  
var swfLoader:Loader = new Loader();  
load1\_mc.addEventListener(MouseEvent.ROLL\_OVER, clickA);

function clickA(event:MouseEvent):void{  
img1Loader.load(swf1Request);  
img1Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadNowA);  
function loadNowA(event:Event):void{  
\_1.addChild(swfLoader);  
}  
}  
function unclickA(event:MouseEvent):void{  
\_1.removeChild(swfLoader);  
}

=========================

My code’s probably a little messy, sorry. But I think what I’m doing is pretty common, I’m just not getting anywhere with it. If anyone could point out what I need to change here, that would be much appreciated!

Many thanks,  
Jon
