package { import javax.microedition.lcdui.game.GameCanvas; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Font; import javax.microedition.lcdui.Image; import java.lang.Exception; import java.lang.System; import resources.Embedder; import flash.events.Event; import flash.display.Bitmap; import flash.display.MovieClip; [SWF(width="240",height="320",backgroundColor="#000000",frameRate=24)] public class Streger extends GameCanvas { private var res:Embedder = new Embedder(); private var font:Font; private var image:Image; private var w:int, h:int, count:int, lastX:int, lastY:int, newX:int, newY:int; private var g:Graphics; private var t:Number, c:Number; private var lastTime:int, cyclems:int; public function Streger() { this.setFullScreenMode(true); g = getGraphics(); w = getWidth(); h = getHeight(); t = 0; c = 3.141592654; count = 0; g = getGraphics(); // Fra GameCanvas h = getHeight(); // Fra Displayable -> Canvas -> GameCanvas w = getWidth(); // Fra Displayable -> Canvas -> GameCanvas var pen:Array = new Array(); pen = [0x000000, 0x00007f, 0x7f0000, 0x7f007f]; var p:int = 1; cyclems = 0; lastTime = System.currentTimeMillis(); this.addEventListener(Event.ENTER_FRAME, cycle); } public function cycle(event:Event):void { cyclems+= System.currentTimeMillis()-lastTime; lastTime = System.currentTimeMillis(); while (cyclems>10) { cyclems-=10; c += 0.0001; } t = c; count = 0; g.setColor(0x000000); g.fillRect(0, 0, w, h); lastX = w/2; lastY = h/2; while (count < 200) { g.setColor((int) (t * 64)); newX = (int) (Math.cos(t) * t / 7 + w / 2); newY = (int) (Math.sin(t) * t / 7 + h / 2); g.drawLine(lastX, lastY, newX, newY); lastX = newX; lastY = newY; t += c; count++; } flushGraphics(); } } }