Easy ColorPicker for everything at stage
Flash, Flex May 24th, 2007How to get color for any pixel at stage, including Sprites, video, Bitmaps etc...
Easy. Just 6 lines of code.
var pickerBMP:BitmapData = new BitmapData(1,1,false,0x0);
stage.addEventListener(MouseEvent.MOUSE_MOVE,checkColor);
function checkColor(e:Event) {
pickerBMP.setPixel(0,0,0xFFFFFF); // enter background color of your SWF
pickerBMP.draw(stage,new Matrix(1,0,0,1,-mouseX,-mouseY));
trace (pickerBMP.getPixel(0,0));
}
Ready to receive fresh news from my site? Subscribe to my RSS.
Хотите быть в курсе последних обновлений сайта? Подпишитесь на мой RSS.
Related Entries:
Ads:
кофейные автоматы









May 26th, 2007 at %I:%M %p
[...] ps:此代码是基于Den (No click)的6行代码,我将用swf的形式实现出来,没办法要增加一行代码. 源文件下载 Add to del.icio.us [...]
May 28th, 2007 at %I:%M %p
[...] от Дена
(Нет голосов) Loading … Добавить новость на News2 [...]
June 15th, 2008 at %I:%M %p
it’s AS3?
can i use this funtion in AS2?
what can i do in AS3 to pickup the color ?
November 4th, 2008 at %I:%M %p
[...] http://www.cleoag.ru/2007/05/24/easy-colorpicker-for-everything-at-stage/ [...]