Yes, that seems to be the issue, since I can manually capture the image with a 
button 
click.  I don't know how to listen to the drawing event completion, though.  
Does anyone 
have any ideas about how to draw after it is completely redrawn?



--- In [email protected], "Jim Hayes" <[EMAIL PROTECTED]> wrote:
>
> 
> I'd suspect that maybe you're calling captureImg() immediately after setting 
> the 
data/drawing the elements in your code?
> If so, it may not actually be rendered to the components graphics when the 
> snapshot is 
taken.
> Just a guess, but it smells a bit like a timing problem to me (I've made too 
> many of the 
same, myself).
> I'm afraid I can't remember offhand the component event when the screen is 
> actually 
drawn, but a crude approach might be to call captureImg via callLater() and see 
if it works.
> (If I'm not completley wrong, that is). 
> I confess I sometimes just add a temporary button to call my fn when I think 
> I've made a 
similar kind of error (which normally confirms it).
> 
> 
> 
> -----Original Message-----
> From: [email protected] on behalf of netdeep
> Sent: Wed 12/03/2008 19:52
> To: [email protected]
> Subject: [flexcoders] captureImage not drawing fresh images
>  
> I'm having a problem creating a png snapshot of a chart I'm drawing.  I can 
> use the 
> ImageSnapshot captureImage method but it only draws the elements added during 
> the 
> creation of the component and if I later add data from messaging or with 
> actionscript 
> (addChild), it only draws the original elements and not the new data.  Here 
> is my 
method:
> 
>  private function captureImg(comp:UIComponent):void {
>                 var imageSnap:ImageSnapshot = 
> ImageSnapshot.captureImage(dynaChart);
>                 var imageByteArray:ByteArray = imageSnap.data as ByteArray;
>                 imgSave.saveImage(imageByteArray);
>             }
> 
> I also have this line in my init() method:  ImageSnapshot.defaultEncoder = 
> PNGEncoder;
> 
> But I don't even know if I need that for sure.
> 
> I then send it to a java servlet to write it to a file.  As I said, it works 
> but only writes the 
visual 
> components added during initialization of the application.  So I am just 
> getting a blank 
chart.
> 
> 
> 
> ______________________________________________________________________
> This communication is from Primal Pictures Ltd., a company registered in 
> England and 
Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson 
House, 
159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 
648874577.
> 
> This e-mail is confidential and may be privileged. It may be read, copied and 
> used only 
by the intended recipient. If you have received it in error, please contact the 
sender 
immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then 
delete 
the e-mail and do not disclose its contents to any person.
> This email has been scanned for Primal Pictures by the MessageLabs Email 
> Security 
System.
> ______________________________________________________________________
>



Reply via email to