hey chet, thanks for the input and it works perfect!!!! :))

--- In flexcoders@yahoogroups.com, Chet Haase <cha...@...> wrote:
>
> 
> You're not giving any height to your uiHolder and then you're using
the height dimension when creating the BitmapData, so it fails because
you're asking it to create a BitmapData with invalid dimensions. Try
it with real values for both width and height and you'll get a better
result.
> 
> Note that you're also creating an opaque BitmapData here, so you get
a white background by default.
> 
> Chet.
> 
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On Behalf Of flexawesome
> Sent: Thursday, February 12, 2009 6:50 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: A very simple code of ImageSnapshot
> 
> I have also tried this code, it didn't work as well -_--
> 
> would u pls take a look? thank you
> 
> ======================================
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
> initialize="init();">
> 
> <mx:Script>
> 
> <![CDATA[
> import mx.graphics.ImageSnapshot;
> import mx.controls.Button;
> 
> private var shape1:Shape;
> private var shape2:Shape;
> 
> private function init():void
> {
> shape1 = new Shape();
> shape2 = new Shape();
> 
> shape1.graphics.beginFill( 0xA4D7F4 );
> shape1.! graphics.drawRect( 0 , 0 , 100, 200 );
> shape1.x = 30;
> shape1.y = 40;
> uiHolder.addChild( shape1 );
> 
> shape2.graphics.beginFill( 0xcc9900 );
> shape2.graphics.drawRect( 0 , 0 , 200, 100 );
> shape2.x = 10;
> shape2.y = 40;
> uiHolder.addChild( shape2 );
> }
> 
> private function makeBitmap(myDO:UIComponent):void
> {
> var myBD:BitmapData = new BitmapData(myDO.width, myDO.height);
> myBD.draw(myDO );
> 
> 
> swfLoader.load( new Bitmap ( myBD));
> }
> ]]>
> </mx:Script>
> 
> <mx:UIComponent id="uiHolder" width="100"/>
> 
> <mx:SWFLoader id="swfLoader" bottom="50" horizontalCenter="0"/>
> 
> <mx:Bu tton id="btn" label="click me to print" click="makeBitmap(
uiHolder );"/>
> </mx:Application>
> 
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "flexawesome" <flexawesome@> wrote:
> >
> > I was trying to take snapshot of the uiHolder.
> >
> > However, I got an error msg of ==>> ArgumentError: Error #2015:
> > Invalid BitmapData.
> >
> > the simple code is here: http://www.privatepaste.com/b7gooBq4EJ
> >
> >
> > Do you have any suggestions?
> >
> > Thank you so much
> >
>


Reply via email to