JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



AS3 - Bitmap screenshot of dragged image


P

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam platinum
Posts: 2 - Registered: 2007-01-31

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;
}
//