flash on 2012-5-15
/**
* Copyright jokehn9 ( http://wonderfl.net/user/jokehn9 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/gUzh
*/
package {
import flash.text.TextField;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var sun:Sprite = new Sprite();
var earth:Sprite= new Sprite();
var moon:Sprite = new Sprite();
var mars:Sprite= new Sprite();
var bt:BitmapData = new BitmapData(456,456,false,0x0);
var bd:Bitmap = new Bitmap(bt);
var te:TextField = new TextField();
te.x = 200;
te.y = 10;
te.textColor = 0xff0000;
te.text = "Strange Universe";
stage.addChild(te);
sun.graphics.beginFill(0xff0000);
sun.graphics.drawCircle(0,0 ,70);
sun.x = 226;
sun.y = 226;
earth.graphics.lineStyle(1,0x0000ff);
earth.graphics.drawCircle(0,0, 28);
earth.graphics.beginFill(0x00ff54);
earth.graphics.drawCircle(0,0,14);
moon.graphics.beginFill(0xffffff);
moon.graphics.drawCircle(0,0,6)
mars.graphics.beginFill(0x876543);
mars.graphics.drawCircle(0,0,10);
earth.x = 200;
earth.y = 0;
mars.x = 120;
addChild(bd);
addChild(sun);
sun.addChild(mars);
earth.addChild(moon);
sun.addChild(earth);
moon.x = 28;
var i:Number = 0;
stage.addEventListener("enterFrame",fc);
function fc(e:Event):void {
i += 0.03;
earth.x = 200*Math.cos(i);
earth.y = 200*Math.sin(i);
mars.x = 120*Math.cos(i*4);
mars.y = 120*Math.sin(i*4);
moon.x = 28*Math.cos(i*2);
moon.y = 28*Math.sin(i*2)
}
}
}
}