views:

256

answers:

1

Hello,

I have a canvas wich is a drawing area. This canvas can be scrolled horizontally and vertically.

I am trying to make a screenshot of the whole canvas, this include visible and scrolled parts.

var bmd:BitmapData = new BitmapData(board.width, board.height, false, 0xffffff);
bmd.draw(board);

This would only show me the visible part of the canvas and its scrolling bars :/

How would you solve such a problem ? Using board.width + board.horizontalScrollPosition wont help in this case.

Thanks a lot.

+1  A: 

I think your best bet is to nest canvases. One canvas is a fixed size which contains the smaller scrollable area and the other is the full canvas. Something like

<mx:Canvas id="boardContainer" width="800" height="600">
  <mx:Canvas id="board" width="800" height="1200" />
</mx:Canvas>

That way you have a reference to a canvas that isn't masked and you should be able to take a bitmapData of the entire area.

James Hay
It works, thanks ! Now i have to refactor a lot of things :)
coulix