Flash Script – Swapping Images in Flash
This tutorial shows you how to use the
Think of a scenario where you have 3 pictures aligned one on top of the other, and you want to move the picture that underlies the top image. There are many ways to do this in Flash, and here, we’ll use the
Download the sample files here.
1. In the above example I’ve used three rectangular movielips. I have given each one instance names: "red", "blue", and "green".
2. These are the actions I’ve applied to each button:
This refers to the instance of the movie clip whose depth is swapped by the instance specified in
myMovieClip. Both instances must have the same parent movie clip.
This refers to the number specifying the depth level where
MovieClip is to be placed.
This swaps the stacking, or z order (depth level), of the specified instance (
MovieClip) with either:
- the movie that’s specified by the target parameter, or
- the movie that currently occupies the depth level specified in the depth parameter.
Both movies must have the same parent movie clip. Swapping the depth level of movie clips has the effect of moving one movie in front of, or behind, the other. And if a movie is tweening when this method is called, the tweening is stopped.