swapDepths() puts it where you want it

March 18, 2010

For DAYS, I’ve been fighting with SwishMax, trying to get my movie clip to stay on top of all the other elements of my movie, for the duration of the movie.

I have my clip in a scene marked as “background” so that it plays for the entire timeline. But, there was one BIG problem. For some reason, with every subsequent scene, my movie control bar would fade in and out with the photos. I have three photos, each in their own scene. They fade in and out consecutively. Well, so was my movie control bar. Doh!

All I needed to do, was to set the depth of the control bar movie clip to zero and it stayed on top of all the scenes. Knowing very little ActionScript, it took me a long time to find the information. No one had this exact problem — that I could “Google,” anyway.

So here it is…

In the first frame of my background scene, all I had to add was one simple bit of script:

onFrame (1) {
   _root.mymovieclip.swapDepths(0);
}

The zero value indicates the topmost visible level of the movie.

That’s it!!! I’m so happy that’s solved. Take a peek at the movie!

Here’s what I used to find the answer:

  1. Google Search
  2. Deductive reasoning….
    AND…
  3. SWISH TUTOR – the ultimate SWISHscript database
Facebooktwittermail