Problem unloading movie?

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.

can you post your code.

If it’s too long, you can post it on www.privatepaste.com

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.

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

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

even when nulling out the urlloaders too ?

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

try this, it may help, it’s a grant skinner post about unload movie issue