forked from: flash on 2010-5-24
/**
* Copyright makc3d ( http://wonderfl.net/user/makc3d )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/fsi6
*/
// forked from hacker_8hg_3yig's flash on 2010-5-24
package {
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.text.*;
import sandy.core.*;
import sandy.core.data.*;
import sandy.core.scenegraph.*;
import sandy.primitive.*;
public class FlashTest extends Sprite {
public function FlashTest() {
scene = new Scene3D( "myScene", this, new Camera3D( 465, 465 ), new Group("root") );
tg = new TransformGroup; tg.rotateZ = 12;
scene.root.addChild (tg);
var s:Sphere = new Sphere;
//tg.addChild (s);
for (var i:int = 0; i < s.aPolygons.length - 6; i += (i > 7) ? 2 : 1) {
var tf:TextField = new TextField;
tf.autoSize = "left";
tf.text = i.toString ();
tf.rotationY = 0;
// 3D rotation above allows us to rotate
// TextField with device fonts, but also
// clears tf.transform.matrix, therefore
// we need wrapper Sprite
var wrapper:Sprite = new Sprite;
wrapper.addChild (tf);
var sp:Sprite2D = new Sprite2D (tf.text, wrapper);
sp.x = Polygon (s.aPolygons[i]).a.x;
sp.y = Polygon (s.aPolygons[i]).a.y;
sp.z = Polygon (s.aPolygons[i]).a.z;
sp.autoCenter = false;
sp.fixedAngle = true;
tg.addChild (sp);
}
addEventListener ("enterFrame", loop);
}
public var scene:Scene3D;
public var tg:TransformGroup;
public function loop (e:*):void {
tg.rotateY++;
scene.render ();
}
}
}