I made a similar app, I didnt know about DisplayObjectWrapper, I'm just using a Canvas (the api shows it allows DisplayObject for addChild method, yes?)
but try changing your line: var bmp:Bitmap = new Bitmap(myBitmapData); to: var bmp:Bitmap = new Bitmap(myBitmapData.clone()); Thats the only thing that looks different from my code On 3/21/07, Troy Gilbert <[EMAIL PROTECTED]> wrote:
Yeah, the problem is that the Canvas container only allows children that implement IUIComponent. It would have been real nice if Adobe had provided a "raw" container that did no layout of its children (but implemented IUIComponent itself), but they didn't. Fortunately, Grant Skinner has provided just such a container... DisplayObjectWrapper. Check out his blog or Google for it. If you wrap your Bitmap with the DisplayObjectWrapper first you'll then be able to add it (or rather, the DisplayObjectWrapper) to the canvas. Troy. On 21 Mar 2007 08:18:46 -0700, tosadavemgr <[EMAIL PROTECTED]> wrote: > > I have a canvas in my layout and the application allows dragging and > dropping items into the canvas. I need to be able to grab a bitmap of > the canvas when the user is finished, so I can display the drawing on > another panel, and in the FlexPrintJob function. > > I've tried using this code, initiated from a button: > > private function myDrawing():void{ > var myBitmapData:BitmapData = new BitmapData(530, 445); > myBitmapData.draw(myWorkspace1); > var bmp:Bitmap = new Bitmap(myBitmapData); > showDrawing.addChild(bmp); //this isn't working > > } > > myWorkspace1 is the ID of the canvas where everything is dropped. > I have a canvas with the ID=showDrawing that I'd like the bitmap to > appear in. > Anyone know what I need to add to the above function to get that done? > > Dave > >