View Full Version : Change contentPath of a Loader component?

12-04-2008, 04:59 AM
is it possible to change the contentPath property of a Loader component, once it has loaded an external image file?

I have a movie clip which contains a Loader component.

At runtime the Loader component loads the external image and a filter is applied to desaturate the image.

What I want to happen, is on the movie clip's onRollOver event, the loader changes out the image for an image of static, then replaces the image with the first image only in full color.

For the onRollOut event, I want the reverse to happen: full color image->load and display static image -> load and display desaturated image.

I am starting to think it is not possible to load a different image into a single Loader component??? Can someone enlighten me? Code below:

imageLoader_1_MC.onRollOver = function() {
this.imageLoader_1.autoLoad = true;
this.imageLoader_1.contentPath = "images/static/static1.jpg";
imageLoader_1_MC.onRollOut = function() {
this.imageLoader_1.autoLoad = true;
this.imageLoader_1.contentPath = "gallery/demo reel/1a.jpg";

where imageLoader_1_MC is the container movie clip and imageLoader_1 is the Loader component.

The above code is on Frame 1 of the timeline.

Thx in advance!

12-04-2008, 02:25 PM
...I guess the answer is, no you can't replace the content of a Loader component (at least not with AS2).

I did a workaround, I used AS to create a new Loader inside the movie clip which contains the original Loader, I placed it at a high depth (1000) and then used the _alpha property to turn it on and off depending on the mouse action (onRollOver/onRollOut).

04-10-2009, 03:03 PM
A lot of people seem to have trouble with this, and though I expect it's to do with mis-reading depths, I found the simplest solution is to pass the name of the image/swf into the new movie in a Dynamic Text box. Then you can simply call this reference from INSIDE the target movie clip. See below...

this.image_img.contentPath = this.image_txt.text;

trace (this.image_txt.text);

I hope this helps some people.