flash on 2012-7-23
♥0 |
Line 33 |
Modified 2012-07-23 02:39:58 |
MIT License
archived:2017-03-20 05:14:34
ActionScript3 source code
/**
* Copyright misinoe ( http://wonderfl.net/user/misinoe )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/odbR
*/
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.utils.ByteArray;
public class FlashTest extends Sprite {
private var _bmp:Bitmap;
private var _bmpdData:BitmapData;
private var _debugTf:TextField;
public function FlashTest() {
// write as3 code here..
this._bmpdData = new BitmapData( 200, 200, true, 0x88888888 );
this._bmp = new Bitmap( this._bmpdData );
this.addChild( this._bmp );
this._debugTf = new TextField();
this.addChild( this._debugTf );
writePoint( 10, 10, 5 );
};
//
public function writePoint( x:int, y:int, size:Number ):void {
var rect:Rectangle = new Rectangle(2, 2, 2, 2 );
var byte:ByteArray = this._bmpdData.getPixels( rect );
var byte2:ByteArray = new ByteArray();
byte.position = 0;
while ( byte.position < byte.length ) {
this._debugTf.appendText( byte.position +"," + byte.readUnsignedInt().toString(16) + "\n" );
byte2.writeUnsignedInt( 0xFF888888 );
};
this._bmpdData.setPixels( rect, byte2 );
this._bmpdData.unlock();
};
}
}