AS3 - Bitmap screenshot of dragged image

Hi

I have an masked image that is externally loaded onto my stage that the user can drag and position.

I then need to be able to record or save where and how the user has positioned the image by either

-taking a bitmap copy of where the user has positioned the image (my first and easiest thought of how to do this)

-or is it possible to get X and Y co ordinates of where they have positioned it

I have a movie currently set up but when the user clicks ‘save and continue’ it takes a copy of the original position of the image - not from where you have last dragged it to, any ideas?

Full code and attached fla file below

Many thanks for any help in advance


stop();

//-------------- 
// Loader
//-------------- 
var imageP1:Loader = new Loader();
var request:URLRequest = new URLRequest('http://www.tiltworld.co.uk/TH785RFD/image.jpg');
imageP1.load(request);
addChild(imageP1);
imageP1.x=100;
imageP1.y=100;
var image_Content:Sprite = new Sprite();
var imageP1_Content:Sprite = new Sprite();
image_Content.buttonMode=true;
imageP1_Content.addChild(imageP1);
image_Content.addChild(imageP1_Content);
addChild(image_Content);
//

//--------------
// Start Up Mask
//--------------
imageP1.mask=landscape_masks.landscape_mask_10x8;
//

//-------------- 
// Drag
//--------------

imageP1.addEventListener(MouseEvent.MOUSE_DOWN, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(event:Event):void {
	image_Content.startDrag();
}
function drop(event:Event):void {
	image_Content.stopDrag();
}
//

//--------------
// Continue
//--------------
continue_btn.addEventListener(MouseEvent.MOUSE_DOWN, contin);
function contin(event:Event):void {
	bitmapCopy();
}
//

//-------------- 
// Bitmap Copy Function
//--------------
function bitmapCopy() {
	var bd:BitmapData = new BitmapData(450, 400);
	bd.draw(imageP1_Content);
	var b:Bitmap = new Bitmap(bd);
	addChild(b);
	b.x=5;
	b.y=480;
}
//

in your method where you have made a call to stopDrag(), you can get the x and y coordinates there.

Thanks Jim, i will have a look to see if i can try and get the co ordinates, would ideally still like to get a screenshot if anyone can help?


stop();

//-------------- 
// Loader
//-------------- 
var im_loader:Loader = new Loader();
var request:URLRequest = new URLRequest('http://www.tiltworld.co.uk/TH785RFD/image.jpg');
im_loader.load(request);
im_loader.x=100;
im_loader.y=100;
var im_container:Sprite = new Sprite();
var overall_container:Sprite = new Sprite();
im_container.buttonMode=true;
im_container.addChild(im_loader);
overall_container.addChild(im_container);
addChild(overall_container);
//

//--------------
// Start Up Mask
//--------------
im_container.mask=landscape_masks.landscape_mask_10x8;
//

//-------------- 
// Drag
//--------------

im_container.addEventListener(MouseEvent.MOUSE_DOWN, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(event:Event):void {
	im_container.startDrag();
}
function drop(event:Event):void {
	im_container.stopDrag();
}
//

//--------------
// Continue
//--------------
continue_btn.addEventListener(MouseEvent.MOUSE_DOWN, contin);
function contin(event:Event):void {
	bitmapCopy();
}
//

//-------------- 
// Bitmap Copy Function
//--------------
function bitmapCopy() {
	var bd:BitmapData = new BitmapData(450, 400);
	bd.draw(overall_container);
	var b:Bitmap = new Bitmap(bd);
	addChild(b);
	b.x=5;
	b.y=480;
}
//