/ Published in: ActionScript 3
I created this snippet as a small utility to populate Michael Vandaniker's Heat Map application with it's necessary gradient information.
It makes it possible to extract a color array for every pixel of a hand drawn gradient (giving you tons of control over the color and style of the gradient). Check out Michael's Heat Map application here: http://michaelvandaniker.com/blog/2008/07/06/how-to-make-heat-maps-in-flex/
I think this could have numerous other applications. Make something cool.
It makes it possible to extract a color array for every pixel of a hand drawn gradient (giving you tons of control over the color and style of the gradient). Check out Michael's Heat Map application here: http://michaelvandaniker.com/blog/2008/07/06/how-to-make-heat-maps-in-flex/
I think this could have numerous other applications. Make something cool.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import flash.display.BitmapData; import flash.display.Bitmap; // Edit your gradient by hand in the library instance, publish to copy the array for the gradient dictionary. //** ColorMC is the linkage ID of my bitmap in the library // this is the height & width of your bitmap var bitWidth:Number = 255; var bitHeight:Number = 10; var bitArray:Array = new Array(); var colorMC:MovieClip = new ColorMC(); var myBitmapData:BitmapData = new BitmapData(bitWidth, bitHeight); myBitmapData.draw(colorMC); var bmp:Bitmap = new Bitmap(myBitmapData); addChild(bmp); for (var i = 0; i < bitWidth; i++) { bitArray.push(myBitmapData.getPixel32(i, 1)); if ( bitArray.length == 254 ) { trace( bitArray ); } }