How to create a two-sided 3DPlane

1. Create a new Flash MX movie and save it under the name 'card.fla'.

2. Create a new MovieClip. Give it a name and linkage name, for example, 'card'.

3. Make two frames in your MovieClip and place and images showing the face of a playing card in the first frame and the back of a playing card in the second frame.

         

4. Add the following ActionScript code to the first frame:

stop();
function swap() {
if (_currentframe == 1) {
gotoAndStop(2);
} else {
gotoAndStop(1);
}
}

This code defined the 'swap' function. This function will be automatically called whenever the 3DPlane turns over. You can also achieve this effect by creating two different movieclips and placing them in the same single frame. You could then switch the value of their '_visible' property using the 'swap' function.

5. Drag the 3DPlane component onto the stage and test your movie (in order to create the advanced live preview swf). After doing this, enter the linkage name in the "Content" parameter of the 3DPlane component.

You may also choose to create more than two frames for a fun effect:

In this example, where we have more than two frames, we can use the following 'swap' function instead:

stop();
function swap() {
if (_currentframe == _totalframes) {
gotoAndStop(1);
} else {
nextFrame();
}
}

The 'swap' function is also used for z-sorting. This is explained in the section "Rotating around other objects using z-sorting".