Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
52
Task/Pinstripe-Display/ActionScript/pinstripe-display.as
Normal file
52
Task/Pinstripe-Display/ActionScript/pinstripe-display.as
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package {
|
||||
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class Pinstripe extends Sprite {
|
||||
|
||||
public function Pinstripe():void {
|
||||
if (stage) init();
|
||||
else addEventListener(Event.ADDED_TO_STAGE, init);
|
||||
}
|
||||
|
||||
private function init(e:Event = null):void {
|
||||
|
||||
var data:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0xFFFFFFFF);
|
||||
data.lock();
|
||||
|
||||
var w:uint = data.width, h:uint = data.height / 4;
|
||||
var x:uint, y:uint = 0, i:uint, px:uint, colour:uint, maxy:uint = h;
|
||||
|
||||
for ( i = 1; i <= 4; i++ ) {
|
||||
|
||||
for ( ; y < maxy; y++ ) {
|
||||
colour = 0xFF000000;
|
||||
px = 1;
|
||||
|
||||
for ( x = 0; x < w; x++ ) {
|
||||
|
||||
if ( px == i ) {
|
||||
colour = (colour == 0xFF000000) ? 0xFFFFFFFF : 0xFF000000;
|
||||
px = 1;
|
||||
}
|
||||
else px++;
|
||||
|
||||
data.setPixel32(x, y, colour);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
maxy += h;
|
||||
|
||||
}
|
||||
|
||||
data.unlock();
|
||||
addChild(new Bitmap(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue