[FMX04] Fading gallery function problem

I’ve finally decided to call on the great wisdom of Kirupa user to help me figure this out as I haven’t been able to find exactly the tips I’m looking for in the forums…I’m not super advanced in Actionscript, but this should be a breeze for most of you!

I’m creating flash image galleries for a local design firm’s site. Their pages are long, vertically scrolling, with large image galleries spaced down the page (about 900x400px each). Each of these shows an initial image, and then has buttons above to select image 1-9, or pre/next image. The images will need to dissolve from one to the next.

Because there are so many of these galleries, I want to put each in a folder, name all of the images Image1.jpg, Image2.jpg, etc. and include a txt file to tell my navigation button how many images are in the gallery (this part works).

OK, but I just can’t get the thing going now. Here’s how I’ve approached it:
Each Gallery image is a MC that has an alpha in/out animation, with a stop action in between that also swaps it to a certain level (just so I can identify it using getInstanceAtDepth when I need to fade it out).

Image_1 is attached to an empty container on stage at the start. I want to define a function that will be called by my gallery buttons that will 1) tell the clip currently onstage to fade out (that works), 2) attach the appropriate clip to my container clip at a particular level (this does not).

Here is the function in question:


_global.galleryFader = function(clickVar) {
        // "clickVar" is returned when the gallery number buttons are pressed
    _root.container.getInstanceAtDepth(10).gotoAndPlay(21);
    _root.conatiner.attachMovie("Img_"+clickVar, "Img", 20);
}

When you click a button, it calls the function, which executes the first part (plays to end of movieclip), but it doesn’t attach a new movie to the stage (my movies are named “Img_1” etc).

I think once I get this going I will be able to work the prev/next buttons easily, then I just have to figure out the best way to load in the images on the fly… THANKS IN ADVANCE!!