# Two Sided 3D Clip

**URL:** <https://forum.kirupa.com/t/two-sided-3d-clip/277816>\
**Category:** open source\
**Created:** [December 17, 2008, 3:19pm UTC](https://forum.kirupa.com/t/two-sided-3d-clip/277816 "2008-12-17T15:19:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chimay](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@Chimay](https://forum.kirupa.com/u/Chimay)\
**Post date:** [December 17, 2008, 3:19pm UTC](https://forum.kirupa.com/t/two-sided-3d-clip/277816/1 "2008-12-17T15:19:05Z")

</div>

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](http://shapevent.com/source/two_sided.html)  
[DOWNLOAD FLA](http://shapevent.com/source/two_sided.zip)

```auto
  
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;
        }
}

```
