I chose Kayβs answer, but Iβll also answer my own question to add some clarification and tell everyone else about what I experienced, did something wrong, and eventually did everything right, in case someone else stumbles upon my question.
If you want to download jpeg gradually, you need two things: URLStream and Loader. Then you need to do the following:
1) You must use URLStream to load jpeg from URLRequest into ByteArray.
2) You need to add the PROGRESS event handler to the URLStream. In this handler, you need to use Loader to loadBytes () the loaded bytes of the URLStream.
3) You need a handler of the COMPLETE Loader handler to access each pass of the loaded jpeg and do whatever you want on it, for example, display it or resize it, etc.
4) You need a URLStream COMPLETE event handler to make sure all bytes are loaded and cleared after you and close the stream.
var urlStream:URLStream = new URLStream();
Some notes throughout the process:
1) ConfirmBytesLoaded - it's your turn to know when the image has been fully loaded.
2) Loader will not send a full event if the bytes provided do not allow more images to be displayed. Therefore, the Loader progress event is not required if you do not want to know the loading progress of each jpeg pass.
3) In onLoaderComplete, you can do whatever you want. At this point, the event gives you a complete image for work. You can access the loader.content attribute. Remember that if this is not the last Loader completion event, it means that it is a partially loaded CustomActions image that you will have either in the lower layer or with some gray pixels in it.
4) When you use loadBytes, it loads the image in the context of your application. Therefore, make sure that you download only trusted content. I'm still not sure if there is a way around this to make it safe. See: http://onflash.org/ted/2008/01/loaderload-vs-loaderloadbytes.php
PS: Here is a link to the main part of my code:
http://orangeflash.eu/?p=13
Here are some links that actually show you the way to read the width and height yourself, by analyzing each byte, as they are loaded using the jped specification:
http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/
http://www.emstris.com/2009/05/extracting-binary-info/
http://blog.onebyonedesign.com/?p=71