flash on 2014-5-2
/**
* Copyright maxs.maxs.90 ( http://wonderfl.net/user/maxs.maxs.90 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9t2s
*/
package {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
public class FlashTest extends Sprite {
var cont:Sprite = new Sprite();
var w:Number = 100;
var pl:Array = new Array();
var line:Boolean = true;
public function FlashTest() {
// write as3 code here..
addChild(cont);
//
Plane(0,0,-(w/2),0,180);
Plane(0,0,(w/2),0,0);
Plane(-(w/2),0,0,0,-90);
Plane((w/2),0,0,0,90);
Plane(0,-(w/2),0,-90,0);
Plane(0,(w/2),0,90,0);
//
cont.x = stage.stageWidth/2;
cont.y = stage.stageHeight/2;
//
addEventListener(Event.ENTER_FRAME,fr);
}
function fr(event:Event):void{
cont.rotationX = (stage.stageWidth/360) * mouseY;
cont.rotationY = (stage.stageHeight/360) * mouseX;
}
//
function Plane(x_:Number,y_:Number,z_:Number,rx_:Number,ry_:Number){
var tri:Sprite = new Sprite();
//tri.graphics.beginFill(0xff9900);
if(line) tri.graphics.lineStyle(0,0xff6600);
tri.graphics.drawTriangles(Vector.<Number>([-(w/2),-(w/2), (w/2),-(w/2), -(w/2),(w/2), (w/2),(w/2)]), Vector.<int>([0,1,2, 1,3,2]));
tri.x = x_;
tri.y = y_;
tri.z = z_;
tri.rotationX = rx_;
tri.rotationY = ry_;
cont.addChild(tri);
pl.push(tri);
}
//
}
}