1 Reply Latest reply on Jul 24, 2009 5:06 AM by mark_Syzygy

    BitmapData.Draw() not working, deadline looming, please help!


      Hi, I'm working on a project where I'm trying to get a snapshot of a dynamically created Sprite.


      I've made a Sprite that contains a few pictures and text fields (with fonts embedded etc).


      while this Sprite is very large (25,196 by 1,832) I am only taking a relatively small slice of it (2,000 by 1,856) using bitmap.draw()


      however it doesn't work. once I've used draw I'm placing it on the stage and I dont see anything. Also I am looking at the bitmap data using getColorBoundsRect and its coming up as being empty.


      I realise there are limits on what draw() can handle but surely if I'm using a clipRect thats under 2,880 pixels wide/high I should be fine, no?


      Strangely if I feed the Sprite into papervision as a MovieMaterial (which is what the bitmap will be used for after I've altered it) and specify the same clipping rectange it works so it must be possible, but I cant see how.


      one other bit of info (if it matters) all the content of the sprite are in the negative y area (which is why the clipRect starts at -height).


      Code included below, would be very very grateful for any help!


      private function makeTexture(W:Number, H:Number, S:String, A:Number=1, B:Number=0):MaterialObject3D{


                  var container:Sprite    = makeFields(W, H, S, A);// returns Sprite.
                  container.alpha          = A;
                  trace("_w=" + container.width + "_h=" + container.height); //traces:   _w=25196.65_h=1832.05

                  var bData:BitmapData     = new BitmapData(W, container.height, true, 0)//0xffffffff)
                  bData.draw(container,new Matrix(),new ColorTransform(),BlendMode.NORMAL, new Rectangle(0, -container.height, W, container.height));
                  var re:Rectangle=bData.getColorBoundsRect(0xffffffff, 0x00000000, false);

                  trace(re.width); // traces: 0
                  trace(re.height);// traces: 0