flash on 2012-4-12
...
@author jc at bk-zen.com
/**
* Copyright bkzen ( http://wonderfl.net/user/bkzen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/nSbe
*/
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author jc at bk-zen.com
*/
[SWF (backgroundColor = "0x000000", frameRate = "30", width = "465", height = "465")]
public class Test91 extends Sprite
{
private var bmd: BitmapData;
private var t: int;
public function Test91()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e: Event = null): void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
//
addChild(new Bitmap(bmd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0), "auto", true));
t = 0;
//bmd.setPixel(stage.stageWidth >> 1, 0, 0xFFFFFF);
addEventListener(Event.ENTER_FRAME, loop);
}
private function loop(e: Event): void
{
bmd.lock();
var w: int = bmd.width, h: int = bmd.height, i: int, f: int;
if (t < h)
{
for (i = 0; i < w; i++)
{
f = ((f << 1) | (bmd.getPixel(i, t) & 1)) & 7;
//if (f > 0 && f < 5)
if (!(f == 1 || f == 3 || f == 4 || f == 6))
//if (f == 1 || f == 3 || f == 4 || f == 6)
bmd.setPixel(i - 1, t + 1, 0xFFFFFF);
}
t++;
}
else
{
removeEventListener(Event.ENTER_FRAME, loop);
}
bmd.unlock();
}
}
}