AS3 - Bitmap Clone of masked area of loaded image

Hi

Once again i have hit a brick wall and am in need of some help!

I have a 2 frame flash file

  • frame 1 the user has an externally loaded image on stage - where they can turn it into different shapes (using masks) and also drag it around…

-frame 2 a bitmap copy of the users selection/dragging gets taken and saved on the stage

On frame 2 i have the bitmap clone code in…:


var imageA1:Bitmap;
imageA1=new Bitmap(Bitmap(imageP1.content).bitmapData.clone());

…but i cannot target the correct object/movieclip/sprite for it to work (currently set at imageP1.content which just gives me the whole image) I basically need to target either a specific area of the stage or target the image within the mask ‘landscape_masks.landscape_mask_10x8.landscape_mask_10x8_main;’

The full code can be seen below and i have attached the fla file

Please, please help??

Many thanks in advance

John

FRAME 1:


stop();

//------------------------------------------------------------------------------------------------ 
// Loader
//------------------------------------------------------------------------------------------------ 

var imageP1:Loader = new Loader();
var request:URLRequest = new URLRequest('http://www.tiltworld.co.uk/TH785RFD/image2.jpg');
imageP1.load(request);
addChild(imageP1);

imageP1.x=200;
imageP1.y=200;

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

//------------------------------------------------------------------------------------------------ 
// Buttons
//------------------------------------------------------------------------------------------------ 

stadium_btn.addEventListener(MouseEvent.MOUSE_DOWN, stadiumView);
pitch_btn.addEventListener(MouseEvent.MOUSE_DOWN, pitchView);
seats_btn.addEventListener(MouseEvent.MOUSE_DOWN, seatView);

function stadiumView(event:Event):void {
	imageP1.mask=landscape_masks.landscape_mask_10x8;
}

function pitchView(event:Event):void {
	imageP1.mask=landscape_masks.landscape_mask_10x8.landscape_mask_10x8_main;
}

function seatView(event:Event):void {
	imageP1.mask=landscape_masks.landscape_mask_10x8.landscape_mask_10x8_sides;
}
//

//------------------------------------------------------------------------------------------------ 
// Continue
//------------------------------------------------------------------------------------------------ 

continue_btn.addEventListener(MouseEvent.MOUSE_DOWN, contin);

function contin(event:Event):void {
	gotoAndStop(2);
}
//

FRAME 2:


//------------------------------------------------------------------------------------------------ 
// Remove Loader off stage
//------------------------------------------------------------------------------------------------

removeChild(image_Content);
//

//------------------------------------------------------------------------------------------------ 
// Bitmap
//------------------------------------------------------------------------------------------------ 

var imageA1:Bitmap;
imageA1=new Bitmap(Bitmap(imageP1.content).bitmapData.clone());

imageA1.x=200;
imageA1.y=200;

addChild(imageA1);
//