I went for bulkloader over making my own queued loader - as it has so
many tested features. Here is a little code to help get you started
( if you need it )...
Instantiate the loader...
<code>
// New Bulk Loader
imgLoader = new BulkLoader( 'NameOfLoaderInstance');
imgLoader.addEventListener(BulkLoader.COMPLETE, AllItemsLoaded ,
false , 0 , true );
</code>
Load images:
<code>
// Clear the loader of any previously loaded images
imgLoader.removeAll();
// Add all the images to the loading queue
for ( var i : int = 0 ; i < _data.length ; i ++ ){
var record : Object = _data.getItemAt( i );
var item : LoadingItem = imgLoader.add( record['uri'] );
item.addEventListener( Event.COMPLETE , completeHandler , false ,
0 , true );
item.addEventListener( ProgressEvent.PROGRESS , progressHandler ,
false , 0 , true );
}
// start loading - one item at a item - this will load images in the
order you added them
imgLoader.start( 1 );
</code>
Image Loaded Event Handler:
<code>
private function completeHandler( e : Event ) : void {
//----------------------------------------
// remove event listeners and reference the bitmap
var item:LoadingItem = e.target as LoadingItem;
item.removeEventListener( Event.COMPLETE , completeHandler );
item.removeEventListener( ProgressEvent.PROGRESS,
progressHandler );
var sURL : String = item.url.url;
var record : Object = getRecordByKey( sURL, 'uri' );
record.loadid = sURL;
view.addImage( imgLoader.getBitmap( record.loadid ) , record );
}
</code>
hope this helps...
Regards
Karim
On 26 Jul 2009, at 09:58, Cor wrote:
Thank guys!!!
It is an eye opener to see all kinds of different approaches.
I will definitely look at the bulkloader but Muzak's method makes a
lot of sence to me in my project for now.
@Muzak,
I normally only use the XML class.
I notice you using XMLList.
Could you explain when XML is appropriate and when to use XML.
I read the help, but this does not explain the nitty-gritty.
Thanks again!!
Cor
PS. I love this list
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders