forked from: flash on 2009-10-26
/**
* Copyright psyark ( http://wonderfl.net/user/psyark )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jCuK
*/
// forked from gupon's flash on 2009-10-26
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(frameRate="30")]
public class FlashTest extends Sprite {
private var sphere:Sphere;
private var l_index:Label;
public function FlashTest() {
sphere = new Sphere();
addChild(sphere);
l_index = new Label();
addChild(l_index);
sphere.x = sphere.y = 200;
addEventListener( Event.ENTER_FRAME, rotateSphere);
}
private function rotateSphere(event:Event=null):void{
sphere.rotationY += 5;
for (var i:int=0; i<sphere.numChildren; i++) {
if (Math.cos(sphere.rotationY / 180 * Math.PI) < 0) {
sphere.addChild(sphere.items[i]);
} else {
sphere.addChildAt(sphere.items[i], 0);
}
}
}
}
}
import flash.display.Sprite;
class Sphere extends Sprite{
private var m:Number = 10;
private var n:Number = 10;
private var s:Number = 10;
public var items:Array;
public function Sphere(){
items = [];
for(var i:int; i<s; i++){
var pane:Sprite = new Sprite();
pane.z = i * 20 - s*10;
addChild(pane);
items[i] = pane;
pane.graphics.beginFill(0xFF0000*Math.random());
pane.graphics.drawRect(0,0,100,100);
pane.graphics.endFill();
pane.x = pane.y = -50;
}
}
}
import flash.text.TextField;
import flash.text.TextFormat;
class Label extends TextField{
public function Label(){
width = 200;
height = 100;
var format:TextFormat = new TextFormat(null,15);
defaultTextFormat = format;
}
public function set _text(text:*):void{
this.text = String(text);
}
}