flash on 2016-5-29
♥0 |
Line 40 |
Modified 2016-05-29 05:22:07 |
MIT License
archived:2017-03-20 16:23:57
ActionScript3 source code
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/0gIi
*/
package {
import flash.text.TextField;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.display.BitmapData;
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
deb = new TextField();
deb.mouseEnabled=false;
deb.textColor=0xFFffFFff;
addChild(deb);
skin = new BitmapData(32,32,false,0);
skin.fillRect(skin.rect, 0);
skin.fillRect(new Rectangle(0,0,64,1),0xFF);
skin.fillRect(new Rectangle(16,0,1,64),0xFF);
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}//ctor
public var deb:TextField;
public var camx:Number = 0;
public var camy:Number = 0;
public var skin:BitmapData;
public function onEnter(e:Event):void
{
graphics.clear();
graphics.lineStyle(2, 0);
var mat:Matrix;
mat = new Matrix(8,0,0,8,-camx,-camy);
graphics.beginBitmapFill(skin, mat,true,false);
graphics.drawRect(0,0,465,465);
graphics.endFill();
camy+=1;
camx+=1;
var c:uint;
c = skin.getPixel(((4+camx)%256)/8, ((4+camy)%256)/8);
deb.text=" "+c;
}//onenter
}//classend
}