package {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.text.TextField;
import flash.events.Event;
public class Main extends Sprite {
private var _bitmap:BitmapData= new BitmapData(100, 100, false, 0xffffffff);
private var _textfield:TextField= new TextField( );
public function Main( ) {
var image:Bitmap = new Bitmap(_bitmap);
addChild(image);
_bitmap.noise(1000, 0, 255, 1|2|4, false);
addChild(_textfield);
_textfield.y = 100;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void {
var colorVal:Number = _bitmap.getPixel(mouseX, mouseY)
_textfield.text = "#" + colorVal.toString(16).toUpperCase( );
}
}
}
|