Jump to content


Crop settings extended

Recommended Posts

Hey Jack,m I am using the following:


var manager : TransformManager = new TransformManager( {bounds:new Rectangle( IMAGE_VIEWPORT.x, IMAGE_VIEWPORT.y, IMAGE_VIEWPORT.width, IMAGE_VIEWPORT.height )} );
var crop : Crop = new Crop( _imageContainer, manager );
crop.cropMode = true;
manager.selectItem( crop );


and it works PERFECT. The mask fits perfectly to the loaded image. And the bounds are perfectly set.


What I am wondering is if I can set the properties of the crop area afterwards?

For instance could I set the crop so its half the size of the loaded image and centered in the middle, while keeping my bounds?


Does that make sense?





so I searched through the Crop.as and the forum and modified the Crop.as a tiny bit to include the ability to pass in a Rectangle.

It would be SO killer if I could use configureCropMode() to assign the values after the fact.

I'm sure there is a better way to implement this idea.

I'm attaching my modified Crop.as file

I apologize if this already exists! Either way it was empowering to add a small thing to your code and have it work! :)

Curious to hear our thoughts

Thanks Jack

- Patrick


- Patrick

Link to comment
Share on other sites

Great, thanks for sharing your solution.


Not that it's a "better" solution, but you could alter the crop's x/y/width/height/rotation however you please. Just toggle cropMode on, make your changes, and then turn it off. Like:

crop.cropMode = true;
crop.x += crop.width / 4;
crop.y += crop.height / 4;
crop.width /= 2;
crop.height /= 2;
crop.cropMode = false;

Link to comment
Share on other sites

oh I see, I didn't realize that you could adjust the crop properties...duh :)


Thanks Jack. This tool is really amazing. I'll have to show you this tool I am working on. You will be proud!


Talk soon!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.