Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
retropunk

removeChild help

Recommended Posts

Hey guys, I am stuck on a small bit of code and I'm hoping to get some help.

I am using the Transform Manager to create a Virtual Post card creator.

The problem happens when I try to create a screen shot of the postcard using draw()

I am able to snap the screenshot just fine but I am unable to remove the previous screen shot when a new one is created. Check the link below.

Maybe there is a better way to do it?

 

1. Add just one image to the stage from the right nav and click NEXT to see the screen shot

2. Then go back and move the image to another spot and click NEXT again

3. You'll see the updated screen shot but you'll also see the previous one. This is where the problem is. I need to remove the previous one.

You'll see how I am trying to use removeChild but maybe I am using it wrong?

 

http://www.z100.com/common/patrick/combos/combos-v1.0.html

 

var bmd:BitmapData;
bmd = new BitmapData( 800, 600, true, 0xF5780E );
var bitmap:Bitmap = new Bitmap( bmd );
var resetTheScreenShot = false;

function screenGrab():void {

if(resetTheScreenShot){
	// this isn't working properly -- need to fix the screen shot grab
	MovieClip(parent).mcSelectFlavor.screengrab.removeChild( bitmap );
}
resetTheScreenShot = true;
MovieClip(parent).mcSelectFlavor.screengrab.addChild( bitmap );

dropArea.managerObj.deselectAll();
bmd.draw(dropArea);

}

 

btw - I realize that this problem has nothing to do with the Transform Manager... :)

Hopefully someone can still point me in the right direction.

Thanks guys

- Patrick

Link to comment
Share on other sites

You probably just need to clear those pixels on your BitmapData by doing a fillRect() with transparent pixels (0x00FFFFFF) before doing your draw() again.

Link to comment
Share on other sites

YES! That was it!

 

I added this before the draw() and now it works perfectly!

 

var rect:Rectangle = new Rectangle(0, 0, 800, 600);

bmd.fillRect(rect, 0x00FFFFFF);

 

Thanks for helping!

- P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×