# Stuck with loader in as3

**URL:** <https://forum.kirupa.com/t/stuck-with-loader-in-as3/298648>\
**Category:** Uncategorized\
**Created:** [October 22, 2009, 11:47am UTC](https://forum.kirupa.com/t/stuck-with-loader-in-as3/298648 "2009-10-22T11:47:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vixiehd](https://avatars.discourse-cdn.com/v4/letter/v/6f9a4e/32.png) [@vixiehd](https://forum.kirupa.com/u/vixiehd)\
**Post date:** [October 22, 2009, 11:47am UTC](https://forum.kirupa.com/t/stuck-with-loader-in-as3/298648/1 "2009-10-22T11:47:35Z")

</div>

Hi,

I have the below code on a frame in my timeline which loads an external swf. I just need to know what code I would need to add to a new frame so when that new frame is entered it unloads the below. When I try and unload it from a new frame it comes up with an error ‘1120: Access of undefined property l.’

If anyone could give me the code I need to do this I would be very grateful. Thanks!

import flash.net.URLLoader;  
import flash.net.URLRequest;

loadGallery();

function loadGallery():void  
{  
var l:Loader = new Loader();  
//load aMediaGallery.swf or aMediaGalleryFlashVar.swf  
var req:URLRequest = new URLRequest(“aMediaGallery.swf”);  
l.load(req);  
l.contentLoaderInfo.addEventListener(Event.INIT, galleryLoaded);  
l.y = 114;  
l.x = 0;

}

function galleryLoaded(e:Event):void  
{  
addChild(e.target.loader);  
e.target.loader.content.initGallery();  
}
