Check attached movie's target

I have these slides, which are movie clips. The slides have a function that automatically moves to the next slide when it is complete.

slides.attachMovie(slideShow*, “slide”, 1);

lastImage.attachMovie(slideShow[i-1], “slideOut”, 1);

The code above is just how the slides are attached. There is quite a bit in between. The slide is first attached in a movie clip titled “slides”, when it is done, it is attached to the movie clip titled “lastImage”.

I would like the function to run while the movie clip is loaded in “slides”, but not when it is loaded in “lastImage”. I’m thinking I should use an if statement (correct me if I’m wrong). I just don’t know the code. Oh, and the function is declared in the main timeline.

Should be along the lines of:

_global.autoAdvance = function (){
if (movie is currently playing in “slides”){
do some actions;

Any help would be soooo much appreciated.