[flexcoders] cropping image under mask

2009-02-23 Thread Mayur Bais
I am trying to crop image in different different shape,
for this , I am trying to use the technique of masking


here is what i am trying to do
:
function drawBMP(): void {

var bd:BitmapData = new
BitmapData(maskedImage.width, maskedImage.height, true, 0);
bd.draw(maskedImage); target.source = new Bitmap(bd);
}

mx:Image  alpha=.3  source=small.jpg  

mx:filters
flash.filters:BlurFilter blurX=20  blurY=20/
/mx:filters

/mx:Image

 mx:Image id=maskedImage mask={topMask}
source=small.jpg

/mx:Image
  !--the image mask--
   mx:HBox id=topMask height=100 width=100
borderStyle=solid backgroundColor=#ff/

mx:Button click=drawBMP() x=1260 y=184/



It works when  we set x, y of the images to 0,0... it gets screwed up when u
increase the x and y of the image..
its because of masking.. can any body please suggest me the solution


Re: [flexcoders] cropping image under mask

2009-02-23 Thread Paul Andrews
- Original Message - 
  From: Mayur Bais 
  To: flexcoders@yahoogroups.com 
  Sent: Monday, February 23, 2009 10:23 AM
  Subject: [flexcoders] cropping image under mask


  I am trying to crop image in different different shape,
  for this , I am trying to use the technique of masking
snip

It works when  we set x, y of the images to 0,0... it gets screwed up when u 
increase the x and y of the image..
its because of masking.. can any body please suggest me the solution


You don't say what it gets screwed up means. Assuming it means we can't see 
the image anymore then that's because you've moved the image outside of the 
area that the mask allows to be showed.

Put mask and image in a container and move the container, not the image.

Paul