Share Posted January 25, 2012 I started playing with Flex Crop for a mobile app I'm building and ran across something that I think may be useful for others. Forgive me if I overlooked something existing in the API... I need to give users the ability to pick an area of their photo to crop to use as a thumbnail image. But there didn't appear to be a way to define a desired rect size for the crop. The crop box seemed to only be able to default to full size of the image. I was able to constrain the scale using of the crop box using the transformManager's constrainScale, but I couldn't find a way to provide a desired rect for the crop box itself. After digging through the class I was able to make a couple of small mods that seem to work in my instance: //Will be used to store the preferred default rect positioning protected var _cropBounds:Rectangle; //In the constructor public function FlexCrop(target:DisplayObject, manager:TransformManager, attached:Boolean=true, fillColor:uint=0x000000, alpha:Number=0, cropBounds:Rectangle = null) { _cropBounds = cropBounds; } //Replaced the first line of _calibrateBox() with: var bounds:Rectangle = _cropBounds?_cropBounds:_target.getBounds(_target); Hope its helpful to someone else Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now