Controlling the loader component with action script

I am having troubles on doing some action script in Flash Mx 2004.

I am building a website; on the first frame it has the preloader component and a loader. The movie that the content path is set to, currently loads fine for the homepage. when I click on a button, I want it to change the contentPath of the loader, and then redo the preloader (so it loads the new movie).
I also want it to unload the existing movie.

What action script would I use to accomplish this, mine is not working.

Thanx in advance,
3dnirvana

[AS]
function imageloader(image){
imgloader.autoLoad=false;
imgLoader.contentPath=image;
pBar.source = imgLoader;
imgLoader.load();
}
[/AS]

Thats a function I have to work with images that I load into a loader, I have buttons with coding -

[AS]
on(release){
loadimage(“http://www.damgproductions.com/images/techie/damgcomp/mammoth.jpg”);
}
[/AS]

So everytime the function is called, the progressbar resets its source again to imgLoader and the imgLoader automatically unloads the old movie and will load the new one.

Hope this helps ya.

Perfect, thanx a lot!

Ok, wait sry spoke too fast. I’m having some troubles getting it to work correctly with .swf . Could you possibly send me a fla file that has it working at least with jpgs?

I currently have 4 layers (loader, actions, button, and bar) I have the loader component in the loader layer, and the progress bar in the bar layer. I also have a button in the button layer to execute the load.

Were do I put the first code? In the loder, or in a second actions frame?

thanx in advance,
3dnirvana

Here’s a link to it -
Loader example

Check it out, and let me know if ya need anymore help.

Great! This is just what I needed! Thank you very much!