# Return SWF from Loader function?

**URL:** <https://forum.kirupa.com/t/return-swf-from-loader-function/263533>\
**Category:** Uncategorized\
**Created:** [June 16, 2008, 10:24pm UTC](https://forum.kirupa.com/t/return-swf-from-loader-function/263533 "2008-06-16T22:24:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![activa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@activa](https://forum.kirupa.com/u/activa)\
**Post date:** [June 16, 2008, 10:24pm UTC](https://forum.kirupa.com/t/return-swf-from-loader-function/263533/1 "2008-06-16T22:24:57Z")

</div>

I want to have a function that loads a SWF and returns the SWF. But how do I have the COMPLETE function (which is triggered by an event) return the MovieClip? Here the isLoaded function returns the clip, but the main function has no return statement. Where/how do I place that?

```auto
loadClip ('someclip.swf');
//
function loadClip (whichSWF:String):MovieClip {
	myLoader = new Loader;
	myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, isLoaded);
	function isLoaded (event:Event):MovieClip {
		return (myLoader.content);
	}
	myLoader.load (new URLRequest(whichSWF));
}

```

---

<div class="post-metadata">

**Author:** ![bzouchir](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bzouchir/32/2088_2.png) [@bzouchir](https://forum.kirupa.com/u/bzouchir)\
**Post date:** [June 17, 2008, 2:36am UTC](https://forum.kirupa.com/t/return-swf-from-loader-function/263533/2 "2008-06-17T02:36:03Z")

</div>

check out the policy file changes for flash player 9:  
[http://www.adobe.com/devnet/flashplayer/articles/fplayer9\_security.html](http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html)

---

<div class="post-metadata">

**Author:** ![activa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@activa](https://forum.kirupa.com/u/activa)\
**Post date:** [June 17, 2008, 1:22pm UTC](https://forum.kirupa.com/t/return-swf-from-loader-function/263533/3 "2008-06-17T13:22:53Z")

</div>

I don’t understand how this security policy applies… I’ve already loaded the SWF and can easily add the loaded SWF clip by using a simple addChild(myLoader.content). But I want to load an external SWF as a library of content, and select children of the of the loaded clip. In other words, I want to send the loaded clip to another function to handle without adding it as a child, making it visible.
