For some reason I expected that with the new z property, rotationX, rotationY, rotationZ, Matrix3D etc… that they would have supported some sort of two-sided movieClip… something like:
MovieClip.front = 1;
MovieClip.back = 2;
// where front and back are the frames from the movieClip to use
Anyway… this code will give you a two sided MovieClip where frame 1 of your clip is the front and frame 2 is the back:
VIEW THE SWF
DOWNLOAD FLA
addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {
box.rotationX = 200 - mouseY;
box.rotationY = mouseX;
makeTwoSided(box);
}
// assumes that frame 1 of the movieClip is the front and 2 the is back
function makeTwoSided(mc:MovieClip):void {
box.gotoAndStop(1);
var rx:Number=Math.abs(mc.rotationX%360);
var ry:Number=Math.abs(mc.rotationY%360);
var turnX:Boolean = (rx > 90 && rx < 270);
var turnY:Boolean = (ry > 90 && ry < 270);
if (turnX != turnY) {
box.gotoAndStop(2);
// make sure the "b" isn't backwards most of the time
box.scaleX = -1;
}
}