# addChild twice on an external preloaded swf

**URL:** https://forum.kirupa.com/t/addchild-twice-on-an-external-preloaded-swf/305606
**Category:** flash
**Created:** [February 28, 2010, 2:21pm UTC](https://forum.kirupa.com/t/addchild-twice-on-an-external-preloaded-swf/305606 "2010-02-28T14:21:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Zen08](https://avatars.discourse-cdn.com/v4/letter/z/6de8d8/32.png) [@Zen08](https://forum.kirupa.com/u/Zen08)
#### Post date: [February 28, 2010, 2:21pm UTC](https://forum.kirupa.com/t/addchild-twice-on-an-external-preloaded-swf/305606/1 "2010-02-28T14:21:12Z")

</div>

Hi!

I hope I’m making sense on this. But is there a way to addChild twice on a preloaded swf?

Here’s my code:

```auto

stop();

import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;

hideEmpty();

function hideEmpty()
{
	empty1_mc.visible = 
	empty2_mc.visible = false;
}

function showEmpty()
{
	trace("show");
	empty1_mc.visible = 
	empty2_mc.visible = true;
}

var mLoader:Loader = new Loader();
var loadernum = 0;
var mySwf:String = "";

function onCompleteHandler(loadEvent:Event)
{
	trace("loader num is " + loadernum);
	empty1_mc.addChild(loadEvent.currentTarget.content);
	empty2_mc.addChild(loadEvent.currentTarget.content);
	stopLoad();
}

function onProgressHandler(mProgress:ProgressEvent)
{
	var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
	trace(percent);
}

function beginLoad()
{
	mySwf = "smashermerc.swf"; 
	var mRequest1:URLRequest = new URLRequest(mySwf);
	
	mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
        mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
	mLoader.load(mRequest1);
}

beginLoad();

function stopLoad()
{
	showEmpty();
	mLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onCompleteHandler);
	mLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgressHandler);
	this.stop();
}

```

Hope someone can help. 😃
