Bobby Francis Joseph
Bobby Francis Joseph

Reputation: 600

Making a bitmap copy of a movieClip

I am developing a Paint Application is AS3. What I am trying is to basically mimick the MS Paint.I am newbie and have some problem implementing the idea that is my head.

I am using vector graphics to implement tools like pencil,line,curve and bitmap to implement bucket tool,spray and eraser. But I faced a problem. While its possible to draw bitmap over vector its not possible to draw vector over bitmap if every drawing is in the same layer.

So the idea that I have is to make it into two layers

  1. Top layer where the vector drawing is done.
  2. In the bottom layer layer after each vector drawing on MOUSE_UP a bitmap copy of the top layer is made and kept on the bottom layer. Keep the top layer fully transparent so that bottom layer is always visible.
  3. Things like flood-fill(bucket tool) , spray and eraser will be directly applied to bottom layer.
  4. After each vector is drawn on MOUSE_UP the top layer will be cleared but everything will be visible because it has been re created in the bottom layer and the top layer is full transparent.

My questions are:

  1. Is there any flaw in my logic.
  2. How to make a bitmap copy of the movie clip on top. I tried but maybe I am stupid it does not work.

The name of the MovieClips are topLayer_mc and bottomLayer_mc. What is need to have is to have a function to create a bitmap copy of topLayer_mc on every MOUSE_UP of pencil,line and add it to bottomLayer_mc.

Can some tell me how to do it.

I mean create a bitmap copy of topLayer_mc on every MOUSE_UP of pencil,line and add it to bottomLayer_mc. A function will do. Thanks in advance.

Upvotes: 0

Views: 676

Answers (1)

Michael Brewer-Davis
Michael Brewer-Davis

Reputation: 14276

  1. I think your overall scheme seems reasonable.
  2. Look at BitmapData.draw(). It allows you to draw an IBitmapDrawable, which is implemented by MovieClip (via DisplayObject).

Upvotes: 2

Related Questions