Even though there are many posts on this particular topic still there are many ???, then i thought may be i can write about it, so lets get started.
Lets do things in steps.
- Load Image in to Flex App
- Convert it to Bitmap and BitmapData objects.
- Crop Image using BitmapData object
1.Load Image in to Flex App
private var imageLoader:Loader = new Loader();
private function fnInit():void
{
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadImageComplete);
imageLoader.load(new URLRequest(“assets/flower.png”));
}
2.Convert it to Bitmap and BitmapData objects
private var bitmapImage:Bitmap;
private var bitmapDataImage:BitmapData;
//Event.COMPLETE eventHandler for Loader
private function loadImageComplete(e:Event):void
{
bitmapImage = Bitmap(e.target.loader.content);
bitmapDataImage = Bitmap(bitmapImage).bitmapData.clone();
}
3.Crop Image using BitmapData object
Read the rest of this entry »