Jump to content
Search Community

setSize rather than width/height

ngchenghow test
Moderator Tag

Recommended Posts

  • 1 year later...

That functionality isn't currently supported, but you could edit the Crop class so that it targets a generic Sprite instance that is exactly the same size (natively) as your target image and then use it as a proxy of sorts so that whenever that Sprite gets moved/resized/rotated, you figure out its width and height and then feed it into your object's special function(s) like setSize().

Link to comment
Share on other sites

Thanks for your input !

 

I did edited Crop.as, adding

 

public var cropWidth:Number
public var cropHeight:Number

 

and edited

 

protected function _calibrateBox():void {
  var bounds:Rectangle = _target.getBounds(_target);
  var g:Graphics = _mask.graphics;
  g.clear();
  g.beginFill(0xFF0000, 1);
  g.drawRect(bounds.x, bounds.y, cropWidth, cropHeight);
  g = this.graphics;
  g.clear();
  g.beginFill(_fillColor, 1);
  g.drawRect(bounds.x, bounds.y, cropWidth, cropHeight);
  trace("_calibrateBox")
 }

 

A bit of a hack since its work in progress but that works so far

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.
×
×
  • Create New...