# Controlling the loader component with action script

**URL:** <https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939>\
**Category:** Uncategorized\
**Created:** [February 18, 2004, 2:22am UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939 "2004-02-18T02:22:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![3d\_Nirvana](https://avatars.discourse-cdn.com/v4/letter/3/a88e4f/32.png) [@3d\_Nirvana](https://forum.kirupa.com/u/3d_Nirvana)\
**Post date:** [February 18, 2004, 2:22am UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939/1 "2004-02-18T02:22:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2004, 6:40pm UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939/2 "2004-02-18T18:40:59Z")

</div>

[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](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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2004, 8:33pm UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939/3 "2004-02-18T20:33:00Z")

</div>

Perfect, thanx a lot!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2004, 8:43pm UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939/4 "2004-02-18T20:43:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 4:42am UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939/5 "2004-02-19T04:42:01Z")

</div>

Here’s a link to it -  
[Loader example](http://www.damgproductions.com/temp/loaderTest.zip)

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 7:03am UTC](https://forum.kirupa.com/t/controlling-the-loader-component-with-action-script/101939/6 "2004-02-20T07:03:04Z")

</div>

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