# Problem unloading movie?

**URL:** <https://forum.kirupa.com/t/problem-unloading-movie/261638>\
**Category:** Uncategorized\
**Created:** [May 29, 2008, 1:50pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638 "2008-05-29T13:50:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloptic](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@cloptic](https://forum.kirupa.com/u/cloptic)\
**Post date:** [May 29, 2008, 1:50pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/1 "2008-05-29T13:50:17Z")

</div>

Hi guys,  
new to Actionscript, and you guys have been a real help. So im hoping you can come through on this one. thanx in advance.

newbie problem: flash website with a frame that displays html. one or more of the html pages have embedded swf’s. using URLLoader to load the html. all pages work fine, for the FIRST CLICK. if I load an html that contains an embedded swf, then try to reload it, the swf glitches (like it does when you are trying to load a movie that is already loaded).

What I need:

1. a way to run a condition check to see if a URLLoader is currently loaded, and if so, unload it before loading the next url.(doesnt unload like a loaded swf ???)
2. a way to unload swf hosted in html page, unless I can just unload the page from the html frame and have it work that way.

your input is most helpful.

---

<div class="post-metadata">

**Author:** ![buginajar](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@buginajar](https://forum.kirupa.com/u/buginajar)\
**Post date:** [May 29, 2008, 6:32pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/2 "2008-05-29T18:32:56Z")

</div>

can you post your code.

If it’s too long, you can post it on [www.privatepaste.com](http://www.privatepaste.com)

---

<div class="post-metadata">

**Author:** ![cloptic](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@cloptic](https://forum.kirupa.com/u/cloptic)\
**Post date:** [May 29, 2008, 9:04pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/3 "2008-05-29T21:04:44Z")

</div>

2 supersimple html pages like

page 1  
\<body\>This is a test\</body\>  
\</html\>

page 2  
\<body\>\<img src=“test.swf”/\>  
\<br\>  
second page test\</body\>  
\</html\>

frame 1 has something like:

var page1req:URLRequest = new URLRequest(“page1.html”);  
var url\_loader:URLLoader = new URLLoader();

url\_loader.addEventListener(Event.COMPLETE, onComplete);  
url\_loader.addEventListener(IOErrorEvent.IO\_ERROR, onError);

function onComplete(e:Event)  
{

```
textwindow.htmlText = (e.target.data);

```

}

function onError(e:IOErrorEvent)  
{  
trace(“Something wrong!”);  
}

url\_loader.load(page1req);

frame2 is like:  
var page2req:URLRequest = new URLRequest(“page2.html”);  
url\_loader.load(page2req);

clicking back and forth, page 1 refreshes properly, page 2 load right the first time, but when clicking back to page2 after that gives me a glitch in the movie(blacked out) and the rest of the html works.

---

<div class="post-metadata">

**Author:** ![rbnzdave](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@rbnzdave](https://forum.kirupa.com/u/rbnzdave)\
**Post date:** [May 29, 2008, 9:15pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/4 "2008-05-29T21:15:16Z")

</div>

try setting the htmltext to null before loading the html into it. this might hopefully clear the cache for the variable.

---

<div class="post-metadata">

**Author:** ![cloptic](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@cloptic](https://forum.kirupa.com/u/cloptic)\
**Post date:** [May 29, 2008, 9:23pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/5 "2008-05-29T21:23:58Z")

</div>

tried that just now, it traces out, but the swf still glitches on the second run.

---

<div class="post-metadata">

**Author:** ![rbnzdave](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@rbnzdave](https://forum.kirupa.com/u/rbnzdave)\
**Post date:** [May 29, 2008, 9:27pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/6 "2008-05-29T21:27:17Z")

</div>

even when nulling out the urlloaders too ?

I’ve found that url loaders dont like being used more than once.

---

<div class="post-metadata">

**Author:** ![Dom\_1](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@Dom\_1](https://forum.kirupa.com/u/Dom_1)\
**Post date:** [May 29, 2008, 9:37pm UTC](https://forum.kirupa.com/t/problem-unloading-movie/261638/7 "2008-05-29T21:37:02Z")

</div>

try [this](http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html), it may help, it’s a grant skinner post about unload movie issue
