In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

PIGG COLLECTION 2011 FALL WINTER

Get Adobe Flash player
by sekiryou 11 May 2011
// forked from ahn's Ameba Pigg Sample
/**
* PIGG COLLECTION 2011 FALL WINTER
* 
* @author Masayuki Komatsu
* http://sekiryou.com/
* http://twitter.com/sekiryou_com
*/
package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Matrix;
    import flash.geom.Matrix3D;
    import flash.geom.PerspectiveProjection;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.geom.Utils3D;
    import flash.geom.Vector3D;
    
    import flash.system.Security;
    import flash.display.Loader;
    import flash.system.LoaderContext;
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.system.ApplicationDomain;
    
    import net.hires.debug.Stats;
    
    [SWF(width = 465, height = 465, backgroundColor = 0xFFFFFF, frameRate = 24)]
    
    public class Main extends Sprite {
        private var projection:PerspectiveProjection;
        private var projectionMatrix3D:Matrix3D;
        private var mtx3D:Matrix3D = new Matrix3D();
        private var mtx3DIdentity:Vector.<Number> = mtx3D.rawData;
        private var cameraMtx3D:Matrix3D = new Matrix3D();
        private var projectedVerts:Vector.<Number> = new Vector.<Number>();
        
        private var objectList:Vector.<Object3D> = new Vector.<Object3D>();
        private var objectCloneList:Vector.<Object3D> = new Vector.<Object3D>();
        
        private var mtrx:Matrix = new Matrix();
        private var screen:Sprite = new Sprite();
        private var screenBitmap:Bitmap;
        
        private const POINT_ZERO:Point = new Point(0, 0);
        private var loader:Loader;
        private var maleModelTexture:BitmapData;
        private var femaleModelTexture:BitmapData;
        private var modelRect:Rectangle = new Rectangle(0, 0, 512, 512);
        
        private var texMF:BitmapData;
        private var texMM:BitmapData;
        private var fd_00_01:BitmapData;
        private var fd_00_02:BitmapData;
        private var fd_01_01:BitmapData;
        private var fd_01_02:BitmapData;
        private var fd_02_01:BitmapData;
        private var fd_02_02:BitmapData;
        private var fd_03_01:BitmapData;
        private var fd_03_02:BitmapData;
        private var fd_04_01:BitmapData;
        private var md_00_01:BitmapData;
        private var md_00_02:BitmapData;
        private var md_01_01:BitmapData;
        private var md_01_02:BitmapData;
        private var md_02_01:BitmapData;
        private var md_02_02:BitmapData;
        private var md_03_01:BitmapData;
        private var md_03_02:BitmapData;
        private var md_04_01:BitmapData;
        private var ms0:Slot;
        private var ms1:Slot;
        private var ms2:Slot;
        private var ms3:Slot;
        private var fs0:Slot;
        private var fs1:Slot;
        private var fs2:Slot;
        private var fs3:Slot;
        private var title:Sprite;
        
        private var tmpIndices:Vector.<int> = new Vector.<int>();
        private var tmpUvts:Vector.<Number> = new Vector.<Number>();
        private var offsetX:Number = 0;
        private var offsetY:Number = 0;
        private var offsetZ:Number = 0;
        private var rotX:Number = 0;
        private var rotY:Number = 0;
        private var rotZ:Number = 0;
        private var value:Number = 0;
        
        public function Main() {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }
        private function init(e:Event = null):void {
            //Security.allowDomain("sekiryou.com");
            projection = new PerspectiveProjection();
            //projection.fieldOfView = 40;
            projection.focalLength = 560;
            projectionMatrix3D = projection.toMatrix3D();
            screen = new Sprite();
            screen.mouseChildren = false;
            
            mtrx.a = 1;
            mtrx.b = 0;
            mtrx.c = 0;
            mtrx.d = 1;
            mtrx.tx = 465 * 0.5;
            mtrx.ty = 465 * 0.5;
            screenBitmap = new Bitmap(new BitmapData(465, 465, false, 0x000000));
            addChild(screenBitmap);
            screenBitmap.visible = false;
            
            //var url:String = "resource.swf";
            var url:String = "http://sekiryou.com/lab/resource_0001.swf"
            var context :LoaderContext = new LoaderContext();
            context.applicationDomain = ApplicationDomain.currentDomain;
            
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, recourceLoader);
            loader.load(new URLRequest(url), context);
        }
        
        private function recourceLoader(e:Event):void {
            var fSlot:Sprite = new Sprite();
            fSlot.x = 0;
            fSlot.y = 400;
            addChild(fSlot);
            
            var mSlot:Sprite = new Sprite();
            mSlot.x = 235;
            mSlot.y = 400;
            addChild(mSlot);
            
            var Btn_none:Class = loader.contentLoaderInfo.applicationDomain.getDefinition( "btn_none" ) as Class;
            
            fs0 = new Slot();
            fs0.addItem(new Btn_none(48, 48));
            fs0.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_00_01" ) as Class)(48, 48));
            fs0.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_00_02" ) as Class)(48, 48));
            fs0.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_04_02" ) as Class)(48, 48));
            fs0.changeItem();
            fs0.x = 140;
            fs0.addEventListener("costumeChange", femaleCostumeChange);
            fSlot.addChild(fs0);
            
            fs1 = new Slot();
            fs1.addItem(new Btn_none(48, 48));
            fs1.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_01_01" ) as Class)(48, 48));
            fs1.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_01_02" ) as Class)(48, 48));
            fs1.changeItem();
            fs1.x = 30;
            fs1.addEventListener("costumeChange", femaleCostumeChange);
            fSlot.addChild(fs1);
            
            fs2 = new Slot();
            fs2.addItem(new Btn_none(48, 48));
            fs2.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_02_01" ) as Class)(48, 48));
            fs2.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_02_02" ) as Class)(48, 48));
            fs2.changeItem();
            fs2.x = 195;
            fs2.addEventListener("costumeChange", femaleCostumeChange);
            fSlot.addChild(fs2);
            
            fs3 = new Slot();
            fs3.addItem(new Btn_none(48, 48));
            fs3.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_03_01" ) as Class)(48, 48));
            fs3.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fb_03_02" ) as Class)(48, 48));
            fs3.changeItem();
            fs3.x = 85;
            fs3.addEventListener("costumeChange", femaleCostumeChange);
            fSlot.addChild(fs3);
            
            ms0 = new Slot();
            ms0.addItem(new Btn_none(48, 48));
            ms0.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_00_01" ) as Class)(48, 48));
            ms0.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_00_02" ) as Class)(48, 48));
            ms0.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_04_01" ) as Class)(48, 48));
            ms0.changeItem();
            ms0.x = 140;
            ms0.addEventListener("costumeChange", maleCostumeChange);
            mSlot.addChild(ms0);
            
            ms1 = new Slot();
            ms1.addItem(new Btn_none(48, 48));
            ms1.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_01_01" ) as Class)(48, 48));
            ms1.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_01_02" ) as Class)(48, 48));
            ms1.changeItem();
            ms1.x = 30;
            ms1.addEventListener("costumeChange", maleCostumeChange);
            mSlot.addChild(ms1);
            
            ms2 = new Slot();
            ms2.addItem(new Btn_none(48, 48));
            ms2.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_02_01" ) as Class)(48, 48));
            ms2.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_02_02" ) as Class)(48, 48));
            ms2.changeItem();
            ms2.x = 195;
            ms2.addEventListener("costumeChange", maleCostumeChange);
            mSlot.addChild(ms2);
            
            ms3 = new Slot();
            ms3.addItem(new Btn_none(48, 48));
            ms3.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_03_01" ) as Class)(48, 48));
            ms3.addItem(new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mb_03_02" ) as Class)(48, 48));
            ms3.changeItem();
            ms3.x = 85;
            ms3.addEventListener("costumeChange", maleCostumeChange);
            mSlot.addChild(ms3);
            
            fd_00_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_00_01" ) as Class)(49, 28);
            fd_00_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_00_02" ) as Class)(46, 23);
            fd_01_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_01_01" ) as Class)(32, 32);
            fd_01_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_01_02" ) as Class)(89, 33);
            fd_02_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_02_01" ) as Class)(40, 26);
            fd_02_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_02_02" ) as Class)(39, 20);
            fd_03_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_03_01" ) as Class)(67, 41);
            fd_03_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_03_02" ) as Class)(60, 44);
            fd_04_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "fc_04_01" ) as Class)(51, 48);
            //fd_04_02 = new (ApplicationDomain.currentDomain.getDefinition( "fc_04_02" ) as Class)(51, 48);
            
            md_00_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_00_01" ) as Class)(38, 37);
            md_00_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_00_02" ) as Class)(38, 49);
            md_01_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_01_01" ) as Class)(127, 79);
            md_01_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_01_02" ) as Class)(113, 147);
            md_02_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_02_01" ) as Class)(44, 25);
            md_02_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_02_02" ) as Class)(44, 28);
            md_03_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_03_01" ) as Class)(60, 44);
            md_03_02 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_03_02" ) as Class)(40, 43);
            md_04_01 = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "mc_04_01" ) as Class)(59, 68);
            
            modelInit();
        }
        
        private function modelInit():void {
            var tex00:BitmapData = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "Texture00" ) as Class)(512, 512);
            var tex01:BitmapData = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "Texture01" ) as Class)(512, 512);
            var tex02:BitmapData = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "Texture02" ) as Class)(512, 256);
            texMF = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "ModelFemale" ) as Class)(256, 256);
            texMM = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "ModelMale" ) as Class)(256, 256);
            
            femaleModelTexture = new BitmapData(256, 256, true, 0x00000000);
            maleModelTexture = new BitmapData(256, 256, true, 0x00000000);
            femaleModelTexture.copyPixels(texMF, texMF.rect, POINT_ZERO);
            maleModelTexture.copyPixels(texMM, texMM.rect, POINT_ZERO);
            
            var tmp:Object3D = new ObjectStage();
            objectList.push(tmp);
            tmp.px = 0;
            tmp.py = 3;
            tmp.pz = 12;
            tmp.texture = tex00;
            
            tmp = new ObjectCatwalk();
            objectList.push(tmp);
            tmp.px = 0;
            tmp.py = 3;
            tmp.pz = 0;
            tmp.texture = tex01;
            
            for (var i:int = 0; i < 4; i++ ) {
                tmp = new ObjectModel();
                objectList.push(tmp);
                tmp.px = 0;
                tmp.py = 3;
                tmp.pz = i * 7 - 5;
                
                if (i% 2 == 1) {
                    tmp.texture = femaleModelTexture;
                } else {
                    tmp.texture = maleModelTexture;
                }
            }
            
            for (i = 0; i < 5; i++ ) {
                tmp = new ObjectCrowd();
                objectList.push(tmp);
                tmp.px = 4.5 + Math.random() * 1.5;
                tmp.py = 3;
                tmp.pz = 5 - i * 3;
                tmp.texture = tex02;
                
                tmp = new ObjectCrowd();
                objectList.push(tmp);
                tmp.px = -4.5 - Math.random() * 1.5;
                tmp.py = 3;
                tmp.pz = 5 - i * 3;
                tmp.uvts[0] *= -1;
                tmp.uvts[2] *= -1;
                tmp.uvts[4] *= -1;
                tmp.uvts[6] *= -1;
                tmp.texture = tex02;
            }
            
            addEventListener(Event.ENTER_FRAME, update);
            
            title = new (loader.contentLoaderInfo.applicationDomain.getDefinition( "Title" ) as Class)();
            title.x = 465 * 0.5;
            title.y = 465 * 0.5;
            addChild(title);
            addEventListener(Event.ENTER_FRAME, titleDesolve);
            
            screenBitmap.visible = true;
        }
        private var titleCount:int = 0;
        private function titleDesolve(e:Event = null):void {
            title.scaleX += 0.007;
            title.scaleY += 0.007;
            
            titleCount += 1;
            
            if (titleCount > 150) {
                title.visible = false;
                removeEventListener(Event.ENTER_FRAME, titleDesolve);
            }
        }
        private function femaleCostumeChange(e:Event):void {
            //base
            femaleModelTexture.copyPixels(texMF, texMF.rect, POINT_ZERO);
            //foot
            if (fs2.selectableItemID == 1) femaleModelTexture.copyPixels(fd_02_01, fd_02_01.rect, new Point(106, 196), null, null, true);
            else if (fs2.selectableItemID == 2) femaleModelTexture.copyPixels(fd_02_02, fd_02_02.rect, new Point(106, 202), null, null, true);
            //bottom
            if (fs0.selectableItemID == 1) femaleModelTexture.copyPixels(fd_00_01, fd_00_01.rect, new Point(106, 168), null, null, true);
            else if (fs0.selectableItemID == 2) femaleModelTexture.copyPixels(fd_00_02, fd_00_02.rect, new Point(107, 168), null, null, true);
            else if (fs0.selectableItemID == 3) femaleModelTexture.copyPixels(fd_04_01, fd_04_01.rect, new Point(104, 144), null, null, true);
            //cap
            if (fs1.selectableItemID == 1) femaleModelTexture.copyPixels(fd_01_01, fd_01_01.rect, new Point(146, 70), null, null, true);
            else if (fs1.selectableItemID == 2) femaleModelTexture.copyPixels(fd_01_02, fd_01_02.rect, new Point(80, 70), null, null, true);
            //top
            if (fs3.selectableItemID == 1) femaleModelTexture.copyPixels(fd_03_01, fd_03_01.rect, new Point(97, 142), null, null, true);
            else if (fs3.selectableItemID == 2) femaleModelTexture.copyPixels(fd_03_02, fd_03_02.rect, new Point(100, 143), null, null, true);
        }
        private function maleCostumeChange(e:Event):void {
            //base
            maleModelTexture.copyPixels(texMM, texMM.rect, POINT_ZERO);
            //foot
            if (ms2.selectableItemID == 1) maleModelTexture.copyPixels(md_02_01, md_02_01.rect, new Point(103, 199), null, null, true);
            else if (ms2.selectableItemID == 2) maleModelTexture.copyPixels(md_02_02, md_02_02.rect, new Point(101, 196), null, null, true);
            //bottom
            if (ms0.selectableItemID == 1) maleModelTexture.copyPixels(md_00_01, md_00_01.rect, new Point(109, 168), null, null, true);
            else if (ms0.selectableItemID == 2) maleModelTexture.copyPixels(md_00_02, md_00_02.rect, new Point(109, 168), null, null, true);
            else if (ms0.selectableItemID == 3) maleModelTexture.copyPixels(md_04_01, md_04_01.rect, new Point(100, 144), null, null, true);
            //cap
            if (ms1.selectableItemID == 1) maleModelTexture.copyPixels(md_01_01, md_01_01.rect, new Point(60, 38), null, null, true);
            else if (ms1.selectableItemID == 2) maleModelTexture.copyPixels(md_01_02, md_01_02.rect, new Point(72, 18), null, null, true);
            //top
            if (ms3.selectableItemID == 1) maleModelTexture.copyPixels(md_03_01, md_03_01.rect, new Point(98, 142), null, null, true);
            else if (ms3.selectableItemID == 2) maleModelTexture.copyPixels(md_03_02, md_03_02.rect, new Point(110, 143), null, null, true);
        }
        
        private function update(e:Event = null):void {
            var i:int
            var j:int
            var len:int;
            var len2:int; 
            
            value += 0.008;
            offsetX = 0 + (Math.cos(value) + 1) / 2 * 8;
            offsetY = 0 + Math.cos(value * 2) * -1;
            offsetZ = -14;
            rotX = -4 - (Math.cos(value) + 1) / 2 * 8;
            rotY = (Math.cos(value) + 1) / 2  * -30;
            //rotZ = 0;
            
            cameraMtx3D.rawData = mtx3DIdentity;
            cameraMtx3D.appendTranslation(-offsetX, -offsetY, -offsetZ);
            cameraMtx3D.appendRotation(-rotX, Vector3D.X_AXIS);
            cameraMtx3D.appendRotation(-rotY, Vector3D.Y_AXIS);
            //cameraMtx3D.appendRotation(-rotZ, Vector3D.Z_AXIS);
            
            objectCloneList.length = 0;
            len = objectList.length;
            for (i = 0; i < len; i++) {
                objectList[i].rx = 90;
                
                if (objectList[i].isMove) {
                    if (objectList[i].px > 0) {
                        objectList[i].px -= 0.03;
                        objectList[i].ry = -45;
                    } else if (objectList[i].pz > -12) {
                        objectList[i].pz -= 0.03;
                        if (objectList[i].ry < 0) {
                            objectList[i].ry += 0.5;
                        }
                    } else {
                        objectList[i].px = 3;
                        objectList[i].pz = 15;
                    }
                }
                
                mtx3D.rawData = mtx3DIdentity;
                mtx3D.appendRotation(objectList[i].rx, Vector3D.X_AXIS);
                mtx3D.appendRotation(objectList[i].ry, Vector3D.Y_AXIS);
                mtx3D.appendTranslation(objectList[i].px, objectList[i].py, objectList[i].pz);
                
                objectList[i].runningAnimationIndex = 1;
                
                if (objectList[i].isBoneHold) {
                    objectList[i].animationList[objectList[i].runningAnimationIndex].animationPlay();
                    len2 = objectList[i].boneList.length;
                    for (j = 0; j < len2; j++) {
                        if (objectList[i].runningAnimationIndex != 0 && objectList[i].animationList[objectList[i].runningAnimationIndex].poseList[j]) {
                            objectList[i].boneList[j].boneMatrix = objectList[i].animationList[objectList[i].runningAnimationIndex].poseList[j];
                        } else {
                            objectList[i].boneList[j].boneMatrix.rawData = mtx3DIdentity;
                            objectList[i].boneList[j].boneMatrix.append(objectList[i].boneList[j].initMatrix);
                        }
                    }
                    
                    objectList[i].updateBone(objectList[i].boneList[0], mtx3D);
                    
                    objectList[i].bcVertices.length = 0;
                    len2 = objectList[i].vertexList.length;
                    for (j = 0; j < len2; j++) {
                        var tmpV3D:Vector3D = objectList[i].combMatrixList[objectList[i].vertexList[j].matrixIndex[0]].transformVector(objectList[i].vertexList[j].v3D);
                        objectList[i].bcVertices.push(tmpV3D.x, tmpV3D.y, tmpV3D.z);
                    }
                    
                    mtx3D.append(cameraMtx3D);
                    objectList[i].c = mtx3D.rawData[14];
                    
                    mtx3D.rawData = mtx3DIdentity;
                    mtx3D.append(cameraMtx3D);
                    mtx3D.transformVectors(objectList[i].bcVertices, objectList[i].cVertices);
                } else {
                    mtx3D.append(cameraMtx3D);
                    mtx3D.transformVectors(objectList[i].vertices, objectList[i].cVertices);
                    objectList[i].c = mtx3D.rawData[14];
                }
                objectCloneList.push(objectList[i]);
            }
            
            objectCloneList.sort(
                function(p1:Object, p2:Object):Number {
                    return (p2.c + p2.layer) - (p1.c + p1.layer);
                }
            );
            
            screenBitmap.bitmapData.fillRect(screenBitmap.bitmapData.rect, 0x000000);
            var g:Graphics = screen.graphics;
            g.clear();
            
            mtx3D.rawData = mtx3DIdentity;
            mtx3D.append(projectionMatrix3D);
            
            len = objectCloneList.length;
            for (i = 0; i < len; i++) {
                tmpIndices.length = 0;
                tmpUvts.length = 0;
                tmpUvts = tmpUvts.concat(objectCloneList[i].uvts);
                
                len2 = objectCloneList[i].mesh.length;
                for (j = 0; j < len2; j++) {
                    var i0x:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i0 * 3 + 0 >> 0];
                    var i0y:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i0 * 3 + 1 >> 0];
                    var i0z:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i0 * 3 + 2 >> 0];
                    var i1x:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i1 * 3 + 0 >> 0];
                    var i1y:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i1 * 3 + 1 >> 0];
                    var i1z:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i1 * 3 + 2 >> 0];
                    var i2x:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i2 * 3 + 0 >> 0];
                    var i2y:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i2 * 3 + 1 >> 0];
                    var i2z:Number = objectCloneList[i].cVertices[objectCloneList[i].mesh[j].i2 * 3 + 2 >> 0];
                    
                    objectCloneList[i].mesh[j].c = i0x * i0x + i0y * i0y + i0z * i0z;
                    var tmp:Number = i1x * i1x + i1y * i1y + i1z * i1z;
                    if (objectCloneList[i].mesh[j].c > tmp) {
                        objectCloneList[i].mesh[j].c = tmp;
                    }
                    tmp = i2x * i2x + i2y * i2y + i2z * i2z;
                    if (objectCloneList[i].mesh[j].c > tmp) {
                        objectCloneList[i].mesh[j].c = tmp;
                    }
                }
                
                objectCloneList[i].mesh.sort(
                    function(p1:Polygon, p2:Polygon):Number {
                        return p2.c - p1.c;
                    }
                );
                
                len2 = objectCloneList[i].mesh.length;
                for (j = 0; j < len2; j++) {
                    tmpIndices.push(
                        objectCloneList[i].mesh[j].i0,
                        objectCloneList[i].mesh[j].i1,
                        objectCloneList[i].mesh[j].i2
                    );
                }
                
                projectedVerts.length = 0;
                Utils3D.projectVectors(mtx3D, objectCloneList[i].cVertices, projectedVerts, tmpUvts);
                g.beginBitmapFill(objectCloneList[i].texture);
                g.drawTriangles(projectedVerts, tmpIndices, objectCloneList[i].uvts, "negative");
                g.endFill();
            }
            screenBitmap.bitmapData.draw(screen, mtrx);
        }
    }
}

import flash.display.BitmapData;
import flash.geom.Matrix3D;
class Object3D /*extends Sprite*/ {
    public var isMove:Boolean;
    public var c:Number = 0;
    public var px:Number;
    public var py:Number;
    public var pz:Number;
    public var vx:Number;
    public var vy:Number;
    public var vz:Number;
    public var rx:Number = 0;
    public var ry:Number = 0;
    public var rz:Number = 0;
    public var tx:Number = 0;
    public var ty:Number = 0;
    public var tz:Number = 0;
    public var vertexList:Vector.<Vertex>;
    public var vertices:Vector.<Number> = new Vector.<Number>();
    public var wVertices:Vector.<Number> = new Vector.<Number>();
    public var cVertices:Vector.<Number> = new Vector.<Number>();
    public var bcVertices:Vector.<Number> = new Vector.<Number>();
    public var indices:Vector.<int> = new Vector.<int>();
    public var uvts:Vector.<Number> = new Vector.<Number>();
    public var mesh:Vector.<Polygon> = new Vector.<Polygon>();
    public var isBoneHold:Boolean;
    public var boneList:Vector.<Bone> = new Vector.<Bone>();
    public var combMatrixList:Vector.<Matrix3D> = new Vector.<Matrix3D>();
    public var runningAnimationIndex:int;
    public var animationList:Vector.<Animation>;
    public var texture:BitmapData;
    public var layer:Number;
    
    public function Object3D() {}
    
    public function updateBone(target:Bone, parentWorldMatrix:Matrix3D):void {
        var tmpBoneMatrix:Matrix3D = target.boneMatrix.clone();
        tmpBoneMatrix.append(parentWorldMatrix);
        
        combMatrixList[target.id] = target.offsetMatrix.clone();
        combMatrixList[target.id].append(tmpBoneMatrix);
        if (target.firstChild)
            updateBone(target.firstChild, tmpBoneMatrix);
        if (target.sibling)
            updateBone(target.sibling, parentWorldMatrix);
    }
}

import flash.geom.Vector3D;
class Vertex {
    private var _v3D:Vector3D;
    private var _x:Number;
    private var _y:Number;
    private var _z:Number;
    private var _weight:Array;
    private var _matrixIndex:Array;
    public function Vertex(x:Number, y:Number, z:Number) {
        _x = x;
        _y = y;
        _z = z;
        _weight = [0, 0, 0];
        _matrixIndex = [0, 0, 0, 0];
        
        _v3D = new Vector3D(_x, _y, _z);
    }
    
    public function get x():Number { return _x; }
    public function get y():Number { return _y; }
    public function get z():Number { return _z; }
    public function get weight():Array { return _weight; }
    public function set weight(value:Array):void {_weight = value;}
    public function get matrixIndex():Array { return _matrixIndex; }
    public function set matrixIndex(value:Array):void {_matrixIndex = value;}
    
    public function get v3D():Vector3D { return _v3D; }
    public function set v3D(value:Vector3D):void {_v3D = value;}
}

import flash.geom.Vector3D;
class Polygon {
    public var c:Number = 0;
    public var x:Number = 0;
    public var y:Number = 0;
    public var z:Number = 0;
    public var i0:int = 0;
    public var i1:int = 0;
    public var i2:int = 0;
    public function Polygon(i0:int, i1:int, i2:int) {
        this.i0 = i0;
        this.i1 = i1;
        this.i2 = i2;
    }
}

import flash.geom.Matrix3D;
import flash.geom.Vector3D;

class Bone {
    private var _id:int;
    public var defMatrix:Matrix3D = new Matrix3D();
    
    public var boneMatrix:Matrix3D = new Matrix3D();
    public var initMatrix:Matrix3D = new Matrix3D();
    public var offsetMatrix:Matrix3D = new Matrix3D();
    private var mtx3DIdentity:Vector.<Number> = boneMatrix.rawData;
    
    private var _firstChild:Bone;
    private var _sibling:Bone;
    
    public function Bone() {
        
    }
    
    public function get id():int {return _id;}
    public function set id(value:int):void {_id = value;}
    
    public function get firstChild():Bone {return _firstChild;}
    public function set firstChild(value:Bone):void {_firstChild = value;}
    
    public function get sibling():Bone {return _sibling;}
    public function set sibling(value:Bone):void {_sibling = value;}
    
}

import flash.geom.Matrix3D;
class Animation {
    private var partList:Vector.<int>;
    private var runningKeyList:Vector.<int>;
    private var keyListArray:Vector.<Object>;
    public var poseList:Vector.<Matrix3D>;
    
    private var _count:Number;
    private var _maxFrame:int;
    private var _isLoop:Boolean;
    
    public function Animation() {
        init();
    }
    private function init():void {
        _count = 0;
        _maxFrame = 0;
        keyListArray = new Vector.<Object>();
        partList = new Vector.<int>();
        runningKeyList = new Vector.<int>();
        poseList = new Vector.<Matrix3D>();
    }
    public function keyRegister(tag:int, keyList:Array):void {
        keyListArray.push(keyList);
        partList.push(tag);
        runningKeyList.push(0);
        
        poseList.push(null);
        
        var len:int = keyList.length;
        for (var i:int = 0; i < len; i++) {
            if (_maxFrame < keyList[i].frame) {
                _maxFrame = keyList[i].frame
            }
        }
    }
    public function animationPlay():void {
        var len:int = partList.length;
        for (var i:int = 0; i < len; i++) {
            if (keyListArray[i][runningKeyList[i] + 1 << 0]) {
                if (keyListArray[i][runningKeyList[i] + 1 << 0].frame <= _count) {
                    runningKeyList[i] += 1;
                }
            }
            
            if (keyListArray[i][runningKeyList[i] + 1 << 0]) {
                var complementPose:Matrix3D = keyListArray[i][runningKeyList[i]].pose.clone();
                complementPose.interpolateTo(keyListArray[i][runningKeyList[i] + 1 << 0].pose, (_count - keyListArray[i][runningKeyList[i]].frame) / (keyListArray[i][runningKeyList[i] + 1 << 0].frame - keyListArray[i][runningKeyList[i]].frame));
                poseList[partList[i]] = complementPose;
            } else {
                poseList[partList[i]] = keyListArray[i][runningKeyList[i]].pose.clone();
            }
        }
        
        _count += 1.2;
        if (_count > _maxFrame) {
            _count = 0;
            
            len = runningKeyList.length;
            for (i = 0; i < len; i++) {
                runningKeyList[i] = 0;
            }
        }
    }
}

import flash.display.Shader;
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.events.MouseEvent;
import caurina.transitions.Tweener;

class Slot extends Sprite {
    private var items:Array;
    private var implementationItem:Sprite;
    private var implementationImage:Bitmap;
    private var selectableItem:Sprite;
    public var selectableItemID:int;
    private var arrangementX:Number;
    private var arrangementY:Number;
    private var appX:Number;
    private var appY:Number;
    private var mouseArea:Sprite;
    public function Slot() {
        items = [];
        selectableItemID = 0;
        addEventListener(MouseEvent.ROLL_OUT, onSlotClose);
        
        appY = -1;
        arrangementX = 56;
        arrangementY = 56;
        
        selectableItem = new Sprite();
        selectableItem.x = -24;
        addChild(selectableItem);
        
        implementationItem = new Sprite();
        implementationItem.buttonMode = true;
        implementationItem.addEventListener(MouseEvent.ROLL_OVER, onItemSelect);
        implementationItem.x = -24;
        addChild(implementationItem);
        
        implementationImage = new Bitmap(new BitmapData(48, 48));
        implementationItem.addChild(implementationImage);
        
        mouseArea = new Sprite();
        mouseArea.visible = false;
        addChild(mouseArea);
        hitArea = mouseArea;
    }
    public function addItem(itemImage:BitmapData):void {
        var tmp:Item = new Item(items.length, itemImage);
        tmp.buttonMode = true;
        tmp.addEventListener(MouseEvent.CLICK, onItemClick);
        selectableItem.addChild(tmp);
        items.push(tmp);
        
        mouseArea.graphics.clear();
        mouseArea.graphics.beginFill(0x000000);
        if (appY == 1) {
            mouseArea.graphics.drawRect(arrangementX * -0.5, 0, arrangementX, appY * arrangementY * items.length + 1);
        } else {
            mouseArea.graphics.drawRect(arrangementX * -0.5, arrangementY, arrangementX, appY * arrangementY * (items.length + 1));
        }
    }
    private function onItemSelect(e:MouseEvent):void {
        var len:int = items.length;
        for (var i:int = 0; i < len; i++) {
            Tweener.addTween(items[i], { y : appY * arrangementY * (i + 1), time : 0.3, transition : "easeInOutCubic"});
        }
    }
    private function onSlotClose(e:MouseEvent):void {
        var len:int = items.length;
        for (var i:int = 0; i < len; i++) {
            Tweener.addTween(items[i], { y : 0, time : 0.5, transition : "easeInOutCubic"});
        }
    }
    private function onItemClick(e:MouseEvent):void {
        selectableItemID = e.target.id;
        changeItem();
    }
    public function changeItem():void {
        implementationImage.bitmapData = items[selectableItemID].image;
        //event
        dispatchEvent(new Event("costumeChange"));
    }
}


import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;

class Item extends Sprite {
    private var _id:int;
    private var _image:BitmapData;
    public function Item(count:int, itemImage:BitmapData) {
        _id = count;
        _image = itemImage
        addChild(new Bitmap(_image));
    }
    public function get id():int { return _id; }
    public function get image():BitmapData { return _image; }
}

import flash.display.Sprite;
import flash.geom.Vector3D;
import flash.geom.Matrix3D;
class ObjectStage extends Object3D {
    public function ObjectStage() {
        init();
    }
    private function init():void {
        var i:int;
        var len:int;
        isBoneHold = false;
        vertices.push(
            -10.000000, -2.000000, 0.000200, 
            -2.000000, -2.000000, 0.000200, 
            -2.000000, 0.000000, 0.000200, 
            -10.000000, -1.000000, 0.000200, 
            -2.000000, -0.000000, 7.000200, 
            -10.000000, -1.000000, 7.000200, 
            -10.000000, -1.000000, 0.000200, 
            -2.000000, 0.000000, 0.000200, 
            10.000000, -1.000000, 7.000200, 
            2.000000, -0.000000, 7.000200, 
            2.000000, 0.000000, 0.000200, 
            10.000000, -1.000000, 0.000200, 
            10.000000, -1.000000, 0.000200, 
            2.000000, 0.000000, 0.000200, 
            2.000000, -2.000000, 0.000200, 
            10.000000, -2.000000, 0.000200
        );
        vertexList = new Vector.<Vertex>(); 
        len = vertices.length;
        for (i = 0; i < len; i += 3) {
            vertexList.push(new Vertex(vertices[i], vertices[i + 1], vertices[i + 2]));
        }
        indices.push(
            0, 3, 2, 
            2, 1, 0, 
            4, 7, 6, 
            6, 5, 4, 
            8, 11, 10, 
            10, 9, 8, 
            12, 15, 14, 
            14, 13, 12
        );
        uvts.push(
            0.604564, -0.533549,
            0.665407, -0.951469,
            0.526100, -0.971750,
            0.534911, -0.543689,
            0.033491, -0.961610,
            0.042302, -0.533550,
            0.534911, -0.543689,
            0.526100, -0.971750,
            0.038374, -0.492087,
            0.038374, -0.041991,
            0.556342, -0.041990,
            0.556342, -0.492087,
            0.556342, -0.492087,
            0.556342, -0.041990,
            0.702320, -0.066320,
            0.629331, -0.504252
        );
        
        isMove = false;
        layer = 0;
        
        len = indices.length;
        for (i = 0; i < len; i += 3) {
            var tmp:Polygon = new Polygon(
                indices[i],
                indices[i + 1 >> 0],
                indices[i + 2 >> 0]
            );
            mesh.push(tmp);
        }
    }
}

import flash.display.Sprite;
import flash.geom.Vector3D;
import flash.geom.Matrix3D;
class ObjectCatwalk extends Object3D {
    public function ObjectCatwalk() {
        init();
    }
    private function init():void {
        var i:int;
        var len:int;
        isBoneHold = false;
        vertices.push(
            2.000000, 16.000000, 0.000000, 
            -2.000000, 16.000000, 0.000000, 
            -2.000000, -10.000000, 0.000000, 
            2.000000, -10.000000, -0.000000, 
            -5.000000, 16.000000, 0.000000, 
            5.000000, 16.000000, 0.000000, 
            5.000000, 16.000000, 7.000000, 
            -5.000000, 16.000000, 7.000000, 
            -2.000000, 16.000000, 0.000000, 
            -5.000000, 16.000000, 0.000000, 
            -2.000000, 12.000000, -0.000000, 
            5.000000, 16.000000, 0.000000, 
            2.000000, 16.000000, 0.000000, 
            2.000000, 12.000000, -0.000000
        );
        vertexList = new Vector.<Vertex>(); 
        len = vertices.length;
        for (i = 0; i < len; i += 3) {
            vertexList.push(new Vertex(vertices[i], vertices[i + 1], vertices[i + 2]));
        }
        indices.push(
            0, 3, 2, 
            2, 1, 0, 
            4, 7, 6, 
            6, 5, 4, 
            8, 10, 9, 
            11, 13, 12
        );
        uvts.push(
            0.950796, -0.025359,
            0.950796, -0.164065,
            0.049204, -0.164066,
            0.049204, -0.025359,
            0.182526, -0.204169,
            0.770460, -0.204169,
            0.770460, -0.615722,
            0.182526, -0.615722,
            0.606990, -0.719302,
            0.669407, -0.802526,
            0.496024, -0.802526,
            0.286063, -0.724185,
            0.223645, -0.807409,
            0.112680, -0.724185
        );
    
        isMove = false;
        layer = 1000;
        
        len = indices.length;
        for (i = 0; i < len; i += 3) {
            var tmp:Polygon = new Polygon(
                indices[i],
                indices[i + 1 >> 0],
                indices[i + 2 >> 0]
            );
            mesh.push(tmp);
        }
    }
}

import flash.display.Sprite;
import flash.geom.Vector3D;
import flash.geom.Matrix3D;
class ObjectCrowd extends Object3D {
    public function ObjectCrowd() {
        init();
    }
    
    private function init():void {
        var i:int;
        var len:int;
        isBoneHold = false;
        vertices.push(
            3.000000, 0.000000, 2.000000, 
            -3.000000, 0.000000, 2.000000, 
            -3.000000, 0.000000, 0.000000, 
            3.000000, -0.000000, 0.000000
        );
        vertexList = new Vector.<Vertex>(); 
        len = vertices.length;
        for (i = 0; i < len; i += 3) {
            vertexList.push(new Vertex(vertices[i], vertices[i + 1], vertices[i + 2]));
        }
        indices.push(
            0, 3, 2, 
            2, 1, 0
        );
        uvts.push(
            0.974124, -0.799155,
            0.030759, -0.799155,
            0.030759, -0.170246,
            0.974124, -0.170245
        );
        
        layer = 0;
        
        len = indices.length;
        for (i = 0; i < len; i += 3) {
            var tmp:Polygon = new Polygon(
                indices[i],
                indices[i + 1 >> 0],
                indices[i + 2 >> 0]
            );
            mesh.push(tmp);
        }
    }
}

import flash.display.Sprite;
import flash.geom.Vector3D;
import flash.geom.Matrix3D;
class ObjectModel extends Object3D {
    public function ObjectModel() {
        init();
    }
    
    private function init():void {
        var i:int;
        var len:int;
        isBoneHold = true;
        for (i = 0; i < 7; i++) {
            var tmpBone:Bone = new Bone();
            boneList.push(tmpBone);
        }
        boneList[0].firstChild = boneList[1];
        boneList[1].sibling = boneList[5];
        boneList[1].firstChild = boneList[2];
        boneList[2].sibling = boneList[3];
        boneList[3].sibling = boneList[4];
        boneList[5].sibling = boneList[6];
        boneList[0].initMatrix.rawData = Vector.<Number>([1,0,0,0,0,0,1,0,0,-1,0,0,0.04520000144839287,0.9764999747276306,0.3668999969959259,1]);
        boneList[1].initMatrix.rawData = Vector.<Number>([-0.9984999895095825,0,0.054999999701976776,0,-0.054999999701976776,0,-0.9984999895095825,0,0,-1,0,0,0,1,0,1]);
        boneList[2].initMatrix.rawData = Vector.<Number>([0.8514000177383423,0.5245000123977661,0,0,0.5245000123977661,-0.8514000177383423,0,0,0,0,-1,0,0.09539999812841415,0.41119998693466187,0,1]);
        boneList[3].initMatrix.rawData = Vector.<Number>([0.8325999975204468,-0.5537999868392944,0,0,-0.5537999868392944,-0.8325999975204468,0,0,0,0,-1,0,-0.17759999632835388,0.4050000011920929,0,1]);
        boneList[4].initMatrix.rawData = Vector.<Number>([-0.9929999709129333,-0.11789999902248383,0,0,-0.11789999902248383,0.9929999709129333,0,0,0,0,-1,0,0,0.44780001044273376,0,1]);
        boneList[5].initMatrix.rawData = Vector.<Number>([-0.9993000030517578,0,-0.03779999911785126,0,-0.03779999911785126,0,0.9993000030517578,0,0,1,0,0,-0.09390000253915787,1,0.05550000071525574,1]);
        boneList[6].initMatrix.rawData = Vector.<Number>([-0.9998999834060669,0,0.012900000438094139,0,0.012900000438094139,0,0.9998999834060669,0,0,1,0,0,0.11509999632835388,1,0.052000001072883606,1]);
        len = boneList.length;
        for (i = 0; i < len; i++) {
            boneList[i].id = i;
            combMatrixList.push(new Matrix3D());
        }
        vertices.push(
            0.257300, 0.095900, 0.957900, 
            0.286500, -0.003700, 0.957900, 
            0.581200, -0.023800, 0.957900, 
            0.435000, 0.192000, 0.957200, 
            0.320700, 0.368200, 0.960200, 
            0.233700, 0.221200, 0.957900, 
            0.257300, 0.095900, 0.957900, 
            0.435000, 0.192000, 0.957200, 
            0.176600, 0.441200, 0.957900, 
            0.233700, 0.221200, 0.957900, 
            0.320700, 0.368200, 0.960200, 
            -0.529600, 0.174500, 0.957900, 
            -0.297100, -0.032000, 0.957900, 
            -0.213200, 0.162200, 0.957900, 
            -0.369600, 0.334900, 0.958700, 
            -0.369600, 0.334900, 0.958700, 
            -0.213200, 0.162200, 0.957900, 
            -0.162300, 0.231400, 0.957900, 
            -0.247700, 0.422800, 0.959000, 
            -0.162300, 0.231400, 0.957900, 
            -0.224000, 0.059500, 0.957900, 
            0.285500, -0.018200, 0.957900, 
            0.233700, 0.221200, 0.957900, 
            -0.124500, 0.471200, 0.957900, 
            -0.247700, 0.422800, 0.959000, 
            -0.162300, 0.231400, 0.957900, 
            -0.124500, 0.471200, 0.957900, 
            -0.162300, 0.231400, 0.957900, 
            0.233700, 0.221200, 0.957900, 
            0.176600, 0.441200, 0.957900, 
            0.285500, -0.018200, 0.957900, 
            -0.224000, 0.059500, 0.957900, 
            0.034600, -0.107500, 0.957900, 
            0.034600, -0.107500, 0.957900, 
            -0.224000, 0.059500, 0.957900, 
            -0.318800, -0.087300, 0.957900, 
            0.024800, -0.186000, 0.957900, 
            0.285500, -0.018200, 0.957900, 
            0.034600, -0.107500, 0.957900, 
            0.046600, -0.177500, 0.957900, 
            0.413800, -0.159000, 0.957900, 
            0.413800, -0.159000, 0.957900, 
            0.046600, -0.177500, 0.957900, 
            0.040100, -0.263500, 0.957900, 
            0.367500, -0.360700, 0.957900, 
            0.024800, -0.186000, 0.957900, 
            -0.318800, -0.087300, 0.957900, 
            -0.214500, -0.178700, 0.957900, 
            0.021700, -0.301100, 0.957900, 
            0.021700, -0.301100, 0.957900, 
            -0.214500, -0.178700, 0.957900, 
            -0.367400, -0.306700, 0.957900, 
            -0.139700, -0.436700, 0.957900, 
            0.367500, -0.360700, 0.957900, 
            0.040100, -0.263500, 0.957900, 
            -0.103900, -0.399900, 0.957900, 
            0.063600, -0.514100, 0.957900, 
            -0.124500, 0.471200, 0.957900, 
            0.176600, 0.441200, 0.957900, 
            0.721800, 0.576000, 0.956000, 
            -0.716200, 0.587000, 0.958300, 
            -0.830000, 0.934900, 0.961100, 
            -0.716200, 0.587000, 0.958300, 
            0.721800, 0.576000, 0.956000, 
            0.788600, 0.837000, 0.955900, 
            -0.830000, 0.934900, 0.961100, 
            0.788600, 0.837000, 0.955900, 
            0.684200, 1.752300, 0.916100, 
            -0.664600, 1.719300, 0.925100, 
            -0.664600, 1.719300, 0.925100, 
            0.684200, 1.752300, 0.916100, 
            -0.028900, 1.951800, 0.939400, 
            -0.124500, 0.471200, 0.957900, 
            -0.716200, 0.587000, 0.958300, 
            -0.569300, 0.190000, 0.991300, 
            0.721800, 0.576000, 0.956000, 
            0.176600, 0.441200, 0.957900, 
            0.573700, 0.014900, 1.000400
        );
        vertexList = new Vector.<Vertex>(); 
        len = vertices.length;
        for (i = 0; i < len; i += 3) {
            vertexList.push(new Vertex(vertices[i], vertices[i + 1], vertices[i + 2]));
        }
        indices.push(
            0, 3, 2, 
            2, 1, 0, 
            4, 7, 6, 
            6, 5, 4, 
            8, 10, 9, 
            11, 14, 13, 
            13, 12, 11, 
            15, 18, 17, 
            17, 16, 15, 
            19, 22, 21, 
            21, 20, 19, 
            23, 25, 24, 
            26, 29, 28, 
            28, 27, 26, 
            30, 32, 31, 
            33, 36, 35, 
            35, 34, 33, 
            37, 40, 39, 
            39, 38, 37, 
            41, 44, 43, 
            43, 42, 41, 
            45, 48, 47, 
            47, 46, 45, 
            49, 52, 51, 
            51, 50, 49, 
            53, 56, 55, 
            55, 54, 53, 
            57, 60, 59, 
            59, 58, 57, 
            61, 64, 63, 
            63, 62, 61, 
            65, 68, 67, 
            67, 66, 65, 
            69, 71, 70, 
            72, 74, 73, 
            75, 77, 76
        );
        uvts.push(
            0.586521, -0.306953,
            0.595737, -0.273530,
            0.694067, -0.265197,
            0.646431, -0.338094,
            0.609199, -0.397598,
            0.579342, -0.348970,
            0.586521, -0.306953,
            0.646431, -0.338094,
            0.561457, -0.422759,
            0.579342, -0.348970,
            0.609199, -0.397598,
            0.324074, -0.337500,
            0.400643, -0.267264,
            0.429732, -0.331679,
            0.378400, -0.390233,
            0.378400, -0.390233,
            0.429732, -0.331679,
            0.447106, -0.354524,
            0.419611, -0.418926,
            0.447106, -0.354524,
            0.425560, -0.297438,
            0.595338, -0.268703,
            0.579342, -0.348970,
            0.461052, -0.433422,
            0.419611, -0.418926,
            0.447106, -0.354524,
            0.461052, -0.433422,
            0.447106, -0.354524,
            0.579342, -0.348970,
            0.561457, -0.422759,
            0.595338, -0.268703,
            0.425560, -0.297438,
            0.511027, -0.240244,
            0.511027, -0.240244,
            0.425560, -0.297438,
            0.393091, -0.248893,
            0.507329, -0.214074,
            0.595338, -0.268703,
            0.511027, -0.240244,
            0.514644, -0.216772,
            0.637441, -0.220954,
            0.637441, -0.220954,
            0.514644, -0.216772,
            0.512019, -0.188079,
            0.620861, -0.153830,
            0.507329, -0.214074,
            0.393091, -0.248893,
            0.427412, -0.217813,
            0.505658, -0.175625,
            0.505658, -0.175625,
            0.427412, -0.217813,
            0.375658, -0.175867,
            0.451011, -0.131222,
            0.620861, -0.153830,
            0.512019, -0.188079,
            0.463175, -0.143304,
            0.518512, -0.104236,
            0.461052, -0.433422,
            0.561457, -0.422759,
            0.735421, -0.481204,
            0.265910, -0.462597,
            0.223388, -0.574410,
            0.265910, -0.462597,
            0.735421, -0.481204,
            0.753177, -0.567410,
            0.223388, -0.574410,
            0.753177, -0.567410,
            0.705020, -0.864842,
            0.265289, -0.833236,
            0.265289, -0.833236,
            0.705020, -0.864842,
            0.469126, -0.919196,
            0.461052, -0.433422,
            0.265910, -0.462597,
            0.319881, -0.334787,
            0.735421, -0.481204,
            0.561457, -0.422759,
            0.702313, -0.293930
        );
        var weightDataList:Array = [];
        var vertexIndexList:Array = [];
        weightDataList.push([]);
        vertexIndexList.push([]);
        weightDataList.push([1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000]);
        vertexIndexList.push([17, 19, 25, 27, 5, 9, 22, 28, 21, 30, 37, 32, 33, 38, 20, 31, 34]);
        weightDataList.push([1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000]);
        vertexIndexList.push([23, 26, 57, 72, 11, 14, 15, 13, 16, 12, 18, 24]);
        weightDataList.push([1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000]);
        vertexIndexList.push([8, 29, 58, 76, 4, 10, 0, 6, 1, 2, 3, 7]);
        weightDataList.push([1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000]);
        vertexIndexList.push([61, 65, 60, 62, 73, 68, 69, 71, 67, 70, 64, 66, 59, 63, 75, 74, 77]);
        weightDataList.push([1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000]);
        vertexIndexList.push([36, 45, 48, 49, 52, 51, 47, 50, 35, 46]);
        weightDataList.push([1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000]);
        vertexIndexList.push([40, 41, 44, 53, 56, 55, 43, 54, 39, 42]);
        len = vertexIndexList.length;
        for (i = 0; i < len; i++) {
            var len2:int = weightDataList[i].length;
            for (var j:int = 0; j < len2; j++) {
                vertexList[vertexIndexList[i][j]].weight.unshift(weightDataList[i][j]);
                vertexList[vertexIndexList[i][j]].matrixIndex.unshift(i);
            }
        }
        boneList[0].offsetMatrix.rawData = Vector.<Number>([
            1.000000,0.000000,0.000000,0.000000,
            0.000000,0.000000,-1.000000,0.000000,
            0.000000,1.000000,0.000000,0.000000,
            0.000000,0.000000,0.000000,1.000000
        ]);
        boneList[1].offsetMatrix.rawData = Vector.<Number>([
            -0.998500,-0.055000,-0.000000,0.000000,
            -0.055000,0.998500,-0.000000,0.000000,
            0.000000,-0.000000,-1.000000,0.000000,
            -0.000000,-0.000000,1.000000,1.000000
        ]);
        boneList[2].offsetMatrix.rawData = Vector.<Number>([
            -0.879000,-0.476900,0.000000,0.000000,
            0.476900,-0.879000,-0.000000,0.000000,
            0.000000,0.000000,1.000000,0.000000,
            -0.296900,0.300100,-1.000000,1.000000
        ]);
        boneList[3].offsetMatrix.rawData = Vector.<Number>([
            -0.800900,0.598800,0.000000,0.000000,
            -0.598800,-0.800900,-0.000000,0.000000,
            0.000000,-0.000000,1.000000,0.000000,
            0.372200,0.238800,-1.000000,1.000000
        ]);
        boneList[4].offsetMatrix.rawData = Vector.<Number>([
            0.998000,0.063100,0.000000,0.000000,
            -0.063100,0.998000,-0.000000,0.000000,
            -0.000000,0.000000,1.000000,0.000000,
            0.052800,-0.444600,-1.000000,1.000000
        ]);
        boneList[5].offsetMatrix.rawData = Vector.<Number>([
            -0.999300,-0.037800,0.000000,0.000000,
            0.037800,-0.999300,0.000000,0.000000,
            0.000000,0.000000,1.000000,0.000000,
            -0.091700,-0.059000,-1.000000,1.000000
        ]);
        boneList[6].offsetMatrix.rawData = Vector.<Number>([
            -0.999900,0.012900,0.000000,0.000000,
            -0.012900,-0.999900,0.000000,0.000000,
            0.000000,0.000000,1.000000,0.000000,
            0.114400,-0.053400,-1.000000,1.000000
        ]);
        var tmpAnimation:Animation = new Animation();
        animationList = new Vector.<Animation>(new Animation());
        animationList.push(tmpAnimation);
        tmpAnimation.keyRegister(
        3,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.832600, -0.553800, -0.000000, 0.000000, 
                    -0.553800, -0.832600, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    -0.177600, 0.405000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 8,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.806300, -0.564500, 0.176700, 0.000000, 
                    -0.590000, -0.788900, 0.171700, 0.000000, 
                    0.042500, -0.242700, -0.969200, 0.000000, 
                    -0.177600, 0.405000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 15,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.832600, -0.553800, -0.000000, 0.000000, 
                    -0.553800, -0.832600, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    -0.177600, 0.405000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 22,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.658900, -0.683800, 0.313600, 0.000000, 
                    -0.375600, -0.660300, -0.650400, 0.000000, 
                    0.651800, 0.310700, -0.691900, 0.000000, 
                    -0.177600, 0.405000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.832600, -0.553800, -0.000000, 0.000000, 
                    -0.553800, -0.832600, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    -0.177600, 0.405000, -0.000000, 1.000000
                    ])
                )
            },
        ]
        );
        tmpAnimation.keyRegister(
        2,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.851400, 0.524500, -0.000000, 0.000000, 
                    0.524500, -0.851400, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    0.095400, 0.411200, 0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 8,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.820800, 0.541800, 0.181000, 0.000000, 
                    0.541100, -0.635800, -0.550400, 0.000000, 
                    -0.183100, 0.549700, -0.815000, 0.000000, 
                    0.095400, 0.411200, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 15,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.851400, 0.524500, -0.000000, 0.000000, 
                    0.524500, -0.851400, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    0.095400, 0.411200, 0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 22,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.897800, 0.306800, -0.315800, 0.000000, 
                    0.427800, -0.778000, 0.460200, 0.000000, 
                    -0.104500, -0.548300, -0.829700, 0.000000, 
                    0.095400, 0.411200, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    0.851400, 0.524500, -0.000000, 0.000000, 
                    0.524500, -0.851400, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    0.095400, 0.411200, 0.000000, 1.000000
                    ])
                )
            },
        ]
        );
        tmpAnimation.keyRegister(
        1,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.998500, 0.000000, 0.055000, 0.000000, 
                    -0.055000, 0.000000, -0.998500, 0.000000, 
                    -0.000000, -1.000000, -0.000000, 0.000000, 
                    0.000000, 1.000000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 8,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.983100, 0.156500, 0.095100, 0.000000, 
                    -0.096400, -0.000500, -0.995300, 0.000000, 
                    -0.155700, -0.987700, 0.015600, 0.000000, 
                    0.000000, 1.000000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 15,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.998500, 0.000000, 0.055000, 0.000000, 
                    -0.055000, 0.000000, -0.998500, 0.000000, 
                    -0.000000, -1.000000, -0.000000, 0.000000, 
                    0.000000, 1.000000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 22,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.995100, 0.034900, 0.092100, 0.000000, 
                    -0.091600, 0.015700, -0.995700, 0.000000, 
                    -0.036200, -0.999300, -0.012400, 0.000000, 
                    0.000000, 1.000000, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.998500, 0.000000, 0.055000, 0.000000, 
                    -0.055000, 0.000000, -0.998500, 0.000000, 
                    -0.000000, -1.000000, -0.000000, 0.000000, 
                    0.000000, 1.000000, -0.000000, 1.000000
                    ])
                )
            },
        ]
        );
        tmpAnimation.keyRegister(
        0,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    1.000000, 0.000000, -0.000000, 0.000000, 
                    0.000000, -1.000000, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    0.045200, 0.976500, 0.366900, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    1.000000, 0.000000, -0.000000, 0.000000, 
                    0.000000, -1.000000, 0.000000, 0.000000, 
                    -0.000000, -0.000000, -1.000000, 0.000000, 
                    0.045200, 0.976500, 0.366900, 1.000000
                    ])
                )
            },
        ]
        );
        tmpAnimation.keyRegister(
        6,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.999900, 0.000000, 0.012900, 0.000000, 
                    0.012900, 0.000000, 0.999900, 0.000000, 
                    0.000000, 1.000000, -0.000000, 0.000000, 
                    0.115100, 1.000000, 0.052000, 1.000000
                    ])
                )
            },
            {
                frame : 8,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.994500, -0.052000, -0.091300, 0.000000, 
                    -0.105100, 0.492500, 0.863900, 0.000000, 
                    0.000000, 0.868700, -0.495300, 0.000000, 
                    0.115100, 1.000000, 0.052000, 1.000000
                    ])
                )
            },
            {
                frame : 15,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.999900, 0.000000, 0.012900, 0.000000, 
                    0.012900, -0.000000, 0.999900, 0.000000, 
                    0.000000, 1.000000, 0.000000, 0.000000, 
                    0.115100, 1.000000, 0.052000, 1.000000
                    ])
                )
            },
            {
                frame : 22,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.961000, -0.006300, 0.276500, 0.000000, 
                    0.244700, -0.484800, 0.839700, 0.000000, 
                    0.128800, 0.874600, 0.467500, 0.000000, 
                    0.115100, 1.000000, 0.052000, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.999900, 0.000000, 0.012900, 0.000000, 
                    0.012900, 0.000000, 0.999900, 0.000000, 
                    0.000000, 1.000000, -0.000000, 0.000000, 
                    0.115100, 1.000000, 0.052000, 1.000000
                    ])
                )
            },
        ]
        );
        tmpAnimation.keyRegister(
        5,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.999300, 0.000000, -0.037800, 0.000000, 
                    -0.037800, 0.000000, 0.999300, 0.000000, 
                    0.000000, 1.000000, -0.000000, 0.000000, 
                    -0.093900, 1.000000, 0.055500, 1.000000
                    ])
                )
            },
            {
                frame : 8,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.994500, -0.080800, 0.066000, 0.000000, 
                    0.100300, -0.567500, 0.817200, 0.000000, 
                    -0.028500, 0.819400, 0.572500, 0.000000, 
                    -0.093900, 1.000000, 0.055500, 1.000000
                    ])
                )
            },
            {
                frame : 15,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.999300, 0.000000, -0.037800, 0.000000, 
                    -0.037800, 0.000000, 0.999300, 0.000000, 
                    0.000000, 1.000000, -0.000000, 0.000000, 
                    -0.093900, 1.000000, 0.055500, 1.000000
                    ])
                )
            },
            {
                frame : 22,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.945100, -0.023500, -0.325900, 0.000000, 
                    -0.269200, 0.621600, 0.735600, 0.000000, 
                    0.185300, 0.783000, -0.593800, 0.000000, 
                    -0.093900, 1.000000, 0.055500, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.999300, 0.000000, -0.037800, 0.000000, 
                    -0.037800, 0.000000, 0.999300, 0.000000, 
                    0.000000, 1.000000, -0.000000, 0.000000, 
                    -0.093900, 1.000000, 0.055500, 1.000000
                    ])
                )
            },
        ]
        );
        tmpAnimation.keyRegister(
        4,
        [
            {
                frame : 1,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.993000, -0.117900, -0.000000, 0.000000, 
                    -0.117900, 0.993000, -0.000000, 0.000000, 
                    0.000000, -0.000000, -1.000000, 0.000000, 
                    0.000000, 0.447800, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 8,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.974200, -0.137400, -0.178800, 0.000000, 
                    -0.141700, 0.989900, 0.011000, 0.000000, 
                    0.175500, 0.036000, -0.983800, 0.000000, 
                    0.000000, 0.447800, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 15,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.993000, -0.117900, -0.000000, 0.000000, 
                    -0.117900, 0.993000, -0.000000, 0.000000, 
                    0.000000, -0.000000, -1.000000, 0.000000, 
                    0.000000, 0.447800, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 22,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.982800, -0.183200, -0.022700, 0.000000, 
                    -0.182800, 0.983000, -0.018000, 0.000000, 
                    0.025600, -0.013500, -0.999600, 0.000000, 
                    0.000000, 0.447800, -0.000000, 1.000000
                    ])
                )
            },
            {
                frame : 29,
                pose : new Matrix3D(
                    Vector.<Number>([
                    -0.993000, -0.117900, -0.000000, 0.000000, 
                    -0.117900, 0.993000, -0.000000, 0.000000, 
                    0.000000, -0.000000, -1.000000, 0.000000, 
                    0.000000, 0.447800, -0.000000, 1.000000
                    ])
                )
            },
        ]
        );
        animationList.push(tmpAnimation);

        isMove = true;
        layer = 0;
        
        len = indices.length;
        for (i = 0; i < len; i += 3) {
            var tmp:Polygon = new Polygon(
                indices[i],
                indices[i + 1 >> 0],
                indices[i + 2 >> 0]
            );
            mesh.push(tmp);
        }
    }
}