Simple Image Cropping with Flex

Here is a simple, pure as3, image cropper I wrote for Flex. I’ll try do a post later in the week describing how to use it in Flash cs3 and cs4.

[kml_flashembed publishmethod=”static” fversion=”9.0.0″ useexpressinstall=”true” replaceId=”flex_image_crop” movie=”http://www.wirelust.com/apps/flex_image_crop/bin-debug/main.swf” width=”640″ height=”458″ targetclass=”flashmovie”]

screenshot for people without flash

[/kml_flashembed]

Features:

  • Very Simple
  • Allows you to set min and max values for height and width
  • Holding shift key keeps aspect ratio

You currently have to do the cropping on your own, either in flash or server side. I will followup later with examples of how to do that.

To embed this into you application, all you have to do is:

span style="color: #ff0000;">"demo1.jpg");
	
	// imageBox is an mx:HBox in my mxml
// Set up the initial crop
 

You can then listen for CropBox.EVENT_CHANGED to get the dimensions of the box as it changes:

span style="color: #009900; font-style: italic;">// snipped ...
 

Files

 Download source code