It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Flash Forum

AS3 - Bitmap screenshot of dragged image

Moderator: Phate

AS3 - Bitmap screenshot of dragged image

Postby oddball25 on Wed Nov 17, 2010 11:35 am

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

Code: Select all
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;
}
//
You do not have the required permissions to view the files attached to this post.
oddball25
 
Posts: 6
Joined: Tue Dec 15, 2009 9:43 pm

Who is online

Users browsing this forum: No registered users and 0 guests