[DefaultProperty("content")]
class RawContainer extends UIComponent
{
   private var _content:Array = [];
   public function set content(value:Array):void
   {
      _content = value;
      for(var i:int = 0;i<_content.length;i++)
      {
          addChildAt(_content[i],i);
      }
      while(numChildren > _content.length)
          removeChildAt(_content.length);
   }
   public function get content():Array { return _content }
}
 
Ely.

 
________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Troy Gilbert
Sent: Wednesday, March 21, 2007 9:42 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] copying bitmap data



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]
<mailto:[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
        
        

        


 

Reply via email to