when you are done with loading/scaling/manipulating etc - get access to display object that is hosted within bitmap image and make bitmap copy of it, example:
// display object is where content is drown/attached in ImageDisplay component
var d:DisplayObject = image.imageDisplay.displayObject;
// but it could not yet be ready
if(d == null) return;
// make copy of display objec drawing
var bd:BitmapData = new BitmapData(d.width, d.height);
var bmp:Bitmap = new Bitmap(bd);
"bmp" should be exact copy of what you're seeing on screen (scaled/smoothed/etc) - *NOT* a copy of underlying bitmap content.
(no: "cacheAsBitmap" has no direct context/relation in api that we developers use)
Thanks for the insight Peter, a real big help to me! A couple of additional questions:
1. How do you load the new Spark Image control? With the MX Image, there was a load() method and you could load your URL and listen for the COMPLETE event to continue processing. The new Spark Image no longer has the load() method. Do I have to use an external loader and then set this loader as the source of the Image, or is there a more handy built in method I am just not seeing? (I actually need to load the image, not just point to a url using source )
2. Is there an event that you can listen for to ensure that the display object that you mentioned in your post is loaded before you continue processing, or is it usually an immediate transfer?
loading starts by setting "source" property to any of supported values:
Component broadcast COMPLETE/READY. "READY" is always fired even if resource is embedded. COMPLETE only when resource is to be loaded (via internal Loader instance). I've not investigated on how to make sure that display object is there already - but READY event being fired should be good place to start I think (there could be delay though before object is attached to display list and lay out by component - so that could be yet avaiable when ready handler fires),
If anyone else stumbles on this, I was in the debug view when I noticed that there's actually a bitmapData property on the Spark image. And it returns a copy.
So just new Bitmap(image.bitmapData)
The problem that most people have with Image.bitmapData is that it is null for untrusted cross domain content.