WHAT'S NEW?
Loading...

spectrum color picker


spectrum color picker
spectrum color picker


Tutorial Details
  • Judul: spectrum color picker
  • Difficulty: Beginner
  • Platform: Flash (Flash Player 10)
  • Bahasa Scripth: AS3
  • Software : Flash Professional CS4/Flash Professional CS5
  • Estimated Completion Time: 15 minutes
  • Created:Ricko Nada (Pustaka Flash)





live demo :

Scripth yang digunakan :
var bitmap:BitmapData = new BitmapData(colorPicker.width, colorPicker.height);
bitmap.draw(colorPicker)
var image:Bitmap = new Bitmap(bitmap);
addChild(image);
image.x=colorPicker.x
image.y=colorPicker.y

var colorTransform:ColorTransform = new ColorTransform(); 
var hex;
var zeros;
var zerosNeeded;

colorPicker.addEventListener(MouseEvent.MOUSE_MOVE, lookupPixel);
function lookupPixel(MouseEvent){
 zeros=""
 zerosNeeded=6-(bitmap.getPixel(colorPicker.mouseX, colorPicker.mouseY).toString(16)).length
 trace(zerosNeeded);
 for(var i:int; i<zerosNeeded; i++){
 zeros+="0"
 }
 textf.text="#" + zeros + bitmap.getPixel(colorPicker.mouseX, colorPicker.mouseY).toString(16).toUpperCase();
 hex="0x" + bitmap.getPixel(colorPicker.mouseX, colorPicker.mouseY).toString(16);
 colorTransform.color = hex;
 example1.transform.colorTransform = colorTransform;
 }

colorPicker.addEventListener(MouseEvent.CLICK, pickPixel);
function pickPixel(MouseEvent){
 textf2.text=textf.text
 example2.transform.colorTransform = colorTransform;
 }


5 Halaman yang sering dikunjungi: 

0 komentar:

Post a Comment