# Loading swf's errors

**URL:** <https://forum.kirupa.com/t/loading-swfs-errors/287514>\
**Category:** flash\
**Created:** [May 2, 2009, 6:11pm UTC](https://forum.kirupa.com/t/loading-swfs-errors/287514 "2009-05-02T18:11:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![waverider303](https://avatars.discourse-cdn.com/v4/letter/w/ac91a4/32.png) [@waverider303](https://forum.kirupa.com/u/waverider303)\
**Post date:** [May 2, 2009, 6:11pm UTC](https://forum.kirupa.com/t/loading-swfs-errors/287514/1 "2009-05-02T18:11:05Z")

</div>

Im making a main page that will load different content into one loader. I have the loading URLRequest calling a variable for the link and then on a certain button click it will change the swf to be loading. The problem is this:  
This code is being called in a movieclip inside the main timeline called “loaderHolder”  
[AS]  
//I have all the variables initiated above these functions  
function startLoad()  
{  
trace(“Started”);  
mRequest = new URLRequest(MovieClip(root).loadContent);  
trace(MovieClip(root).loadContent);  
mLoader.load(mRequest);  
}// end function

function onProgressHandler(mProgress:ProgressEvent)  
{  
var percent:Number = Math.round((mProgress.bytesLoaded / mProgress.bytesTotal)\*100);  
load\_txt.text = percent + “%”;  
load\_txt.setTextFormat(LF\_txt);  
}// end function

function onCompleteHandler(loadEvent:Event)  
{  
loadContent\_mc.addChild(loadEvent.currentTarget.content);  
removeChildAt(2);  
removeChildAt(1);  
}// end function  
[/AS]

This is on the main timeline. These functions trigger a tween that will drop then comeback (yoyo) with new content to load.

[AS]  
//Tween/Start Loader  
// Working to get tween to run then pop back with new content  
var loadLoaderTween:Tween = new Tween(loaderHolder, “y”, Strong.easeInOut, 1191.0, stage.stageHeight/2, 2, true);  
loadLoaderTween.addEventListener(TweenEvent.MOTION\_STOP, startLoading);  
//This initiates the very first load  
function startLoading(e:TweenEvent) {  
this.loaderHolder.startLoad();  
}

//Unload Current - Triggers on a button click  
function unLoad() {  
loadLoaderTween = new Tween(loaderHolder, “y”, Strong.easeInOut, loaderHolder.y, 1191.0, 2, true);  
loadLoaderTween.addEventListener(TweenEvent.MOTION\_STOP, startNewLoad);  
this.loaderHolder.mLoader.close();  
}  
function startNewLoad(e:TweenEvent) {  
loadLoaderTween.removeEventListener(TweenEvent.MOTION\_STOP, startNewLoad);  
loadLoaderTween.yoyo();  
trace(“Works”);  
loadContent = “/flash/test2.swf”;  
this.loaderHolder.startLoad();  
}  
[/AS]

I get these errors:

```auto

Error: Error #2029: This URLStream object does not have a stream opened.
	at flash.display::Loader/close()
	at csteelmedia_fla::MainTimeline/unLoad()
	at csteelmedia_fla::btn_web_8/clicked()

```

```auto

//This one happens at this point: mLoader.load(mRequest);
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
	at flash.display::Loader/_load()
	at flash.display::Loader/load()
	at csteelmedia_fla::mc_loaderHolder_1/startLoad()
	at csteelmedia_fla::MainTimeline/startNewLoad()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at fl.transitions::Tween/stop()
	at fl.transitions::Tween/set time()
	at fl.transitions::Tween/nextFrame()
	at fl.transitions::Tween/onEnterFrame()

```
