Jump to content

AS3 - Bitmap screenshot of dragged image


Recommended Posts

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

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/218945-as3-bitmap-screenshot-of-dragged-image/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.