the bitmapdata in loader wll only be valid when the loaders contentLoaderInfo 
Complete event fires.

So add a listener for it and only then access the data.

> loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderCompleteHandler);

This one got me also :( 

See http://ifeedme.com/blog/?p=5



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Giro
Sent: 01 April 2008 10:28
To: [email protected]
Subject: [flexcoders] [AIR] Load image return null

Because this piece of code, that user AlivePDF make error and say that image 
variable is null.
 
var fileimg:File = File.desktopDirectory.resolvePath("images/1.jpg");
var filestream:FileStream=new FileStream();
filestream.open(fileimg,"read");
var bytesRead:ByteArray=new ByteArray();
filestream.readBytes(bytesRead,0,filestream.bytesAvailable);
var loader:Loader=new Loader();
loader.loadBytes(bytesRead);
var image:Bitmap = Bitmap(loader.content);
myPDF.addImage(image, 1 , "Normal", null , false, ImageFormat.JPG, 100, 0, 0, 
0, 0);
 
 
Thank.
Giro.
 

______________________________________________________________________
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