http://www.mediafire.com/?g5jgql5czqa157x
dejo el código también
Código actionscript:
Ver original
// fade in the entire stage stop(); var cornerMask:Shape=new Shape(); addChild(cornerMask); with (cornerMask.graphics) { beginFill(0x0, 1); drawRect(0,0,600,500); endFill(); } var enterFader:Function = function(event:Event):void { if(cornerMask.alpha>0){ cornerMask.alpha-=.02; }else{ // clean up memory removeChild(cornerMask); removeEventListener(Event.ENTER_FRAME,enterFader); cornerMask=null; enterFader=null; } } addEventListener(Event.ENTER_FRAME, enterFader); // simple positioning of the cubeMC holder and its 6 picture holding subMCs which make up all 6 sides cube.z=600; // increase cube holder z to get enough space for its rotation // the picture's dimension is 360x360 dots and its registration point is centered cube.pix0.z=-180; // move the front 180 dots closer in the field of view (z) cube.pix1.x=180; // side to the right cube.pix1.rotationY=90; cube.pix2.x=-180; // side to the left cube.pix2.rotationY=-90; cube.pix3.z=180; // backside //cube.pix3.rotationY=180; cube.pix4.y=-180; // top cube.pix4.rotationX=90; cube.pix5.y=180; // bottom cube.pix5.rotationX=-90; // initiate variables var c:uint, transformedMatrix:Matrix3D, cubeSide:MovieClip, sortArray:Array = new Array(); // prepare the array for the sortOn 'z', the object's fields in the array will store the particular movieClip plus its z position for(c = 0; c < cube.numChildren; c++){ sortArray[c]=new Object(); } // initiate speed variables for change of direction via mouse with acceleration var thrust:Number=.8,stepRemX:Number=0,stepX:Number,stepRemY:Number=0,stepY:Number, accelerate:Number=.08; // render loop and function cube.addEventListener(Event.ENTER_FRAME, render); function render(event:Event):void { // accelerate the rotation stepX=(mouseX-stage.stageWidth/2)/(stage.stageWidth/2)*-thrust; // will produce values ranging btw 0.8 to -0.8 depending on the mouse x position if (stepRemX<stepX) { stepRemX+=accelerate; } else if (stepRemX>stepX) { stepRemX-=accelerate; } stepY=(mouseY-stage.stageHeight/2)/(stage.stageHeight/2)*thrust; if (stepRemY<stepY) { stepRemY+=accelerate; } else if (stepRemY>stepY) { stepRemY-=accelerate; } // simply rotate the whole cube holder cube.rotationX+=stepRemX; cube.rotationY+=stepRemY; for(c=0; c<6; c++){ // get a reference to all 6 cube sides cubeSide = MovieClip(cube.getChildAt(c)); //This transformed matrix contains the actual transformed Z position. transformedMatrix = cubeSide.transform.getRelativeMatrix3D(this); //store this cubeSideMC and its 'z' position in the sortArray. sortArray[c].MCobject=cubeSide; sortArray[c].screenZ=transformedMatrix.position.z; } // sorting sortArray.sortOn("screenZ", Array.NUMERIC | Array.DESCENDING); for(c=0; c<6; c++){ // set the 3 sides in the back to visible = false and render the 3 in the front according to their Z Sorted value. if(c<3){ sortArray[c].MCobject.visible=false; }else{ cube.setChildIndex(sortArray[c].MCobject, c); sortArray[c].MCobject.visible=true; } } }