0 まだなにもない
import net.hires.debug.Stats;
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import flash.text.*;
// import net.hires.debug.Stats;
[SWF(width = "465", height = "465", frameRate = "60", backgroundColor = "#808080")]
public class Test extends Sprite {
private const VMEM_W:int = 465, VMEM_H:int = 465;
private const BOX_SIZE:int = 10;
private const LINE_DIV:uint = 100;
private var vmem:BitmapData = new BitmapData(VMEM_W, VMEM_H, false, 0x808080);
private function toRect(x:Number, y:Number, size:Number) : Rectangle {
var vw:Number = VMEM_W / 2;
var vh:Number = VMEM_H / 2;
var s:Number = size / 2;
return new Rectangle(
-s + x + vw, - s + vh - y,
size, size);
}
private function drawLine(x1:Number, y1:Number, x2:Number, y2:Number, color:Number) : void {
var dx:Number = x2 - x1;
var dy:Number = y2 - y1;
for (var i:uint = 0; i <= LINE_DIV; i++) {
drawRect(x1 + dx * i / LINE_DIV, y1 + dy * i / LINE_DIV, 4, color);
}
}
private function drawRect(x:Number, y:Number, size:Number, color:Number) : void {
var r:Rectangle = toRect(x, y, size);
vmem.fillRect(r, color);
}
public function update(event:Event) : void {
vmem.lock();
vmem.fillRect(vmem.rect, 0x808080);
vmem.unlock();
}
public function Test() {
var text:TextField = new TextField();
text.text = "test1 moving box";
addChild(text);
addChild(new Bitmap(vmem));
addEventListener(Event.ENTER_FRAME, update);
// addChild(new Stats());
}
}
}