PDA

View Full Version : bitmap in canvas, do not display outside part


finecur
10-24-2007, 04:20 AM
Hi, I have a canvas object in my app:

<mx:Canvas id="canvas".../>

Then in my actionsript, I use the following code to show a bitmap:

var uiHolder:UIComponent = new UIComponent();
var bitmapHolder:Sprite = new Sprite();
canvas.addChild(uiHolder);
uiHolder.addChild(bitmapHolder);

var bitmap:Bitmap = ...
bitmapHolder.addChild(bitmap);

It works fine with only one problem. My bitmap is larger than the canvas, so I expect the canvas to do some cliping. But that is not the case. Even the bitmap is a child of canvas, flash display the whole Bitmap anyway. And the part of the bitmap outside the canvas mess up all my UI design.

How can I tell flash do not display the part of bitmap that is outside the canvas?

Thanks,

ff

finecur
10-24-2007, 04:21 AM
Hi, I have a canvas object in my app:

<mx:Canvas id="canvas".../>

Then in my actionsript, I use the following code to show a bitmap:

var uiHolder:UIComponent = new UIComponent();
var bitmapHolder:Sprite = new Sprite();
canvas.addChild(uiHolder);
uiHolder.addChild(bitmapHolder);

var bitmap:Bitmap = ...
bitmapHolder.addChild(bitmap);

It works fine with only one problem. My bitmap is larger than the canvas, so I expect the canvas to do some cliping. But that is not the case. Even the bitmap is a child of canvas, flash display the whole Bitmap anyway. And the part of the bitmap outside the canvas mess up all my UI design.

How can I tell flash do not display the part of bitmap that is outside the canvas?

Thanks,

ff