i need to use the GetPixel32 on an Object in a movieclip.
in order to get to that object i use:
var bitmap=clip.getChildAt(0);
//and then
bitmap.bitmapData.getPixel32(x, y);
however, even though the childobject is a png i get an error and using
trace(clip.getChildAt(0));
traces "[object Shape]"
so does Flash convert certain bitmaps into shapes?
please see the this fla ( http://www.sendspace.com/file/uycmm5 ) to test it yourself.
Any ideas?
Bitmaps placed in Flash's timeline are converted to shapes (with bitmapfill) on compilation, (UPDATE) unless the image in the library has a linkage name, in which case it works as expected and compiles to a Bitmap object.
You can however draw a new bitmap with that shape:
var shape:DisplayObject = clip.getChildAt(0);
var bmp:BitmapData = new BitmapData(shape.width, shape.height, true, 0);
bmp.draw(shape);
bmp.getPixel32(x, y);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With