bennyxqg / bulk-loader

Automatically exported from code.google.com/p/bulk-loader
0 stars 0 forks source link

getXXX with clearMemory = true causing queue not to fully load #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

var files:Array = [ 
        { id: "file1", url: "file1.jpg" }, 
        { id: "file2", url: "file2.jpg" }, 
        { id: "file3", url: "file3.jpg" },
        { id: "file4", url: "file4.jpg" }, 
        { id: "file5", url: "file5.jpg" }, 
        { id: "file6", url: "file6.jpg" }, 
        { id: "file7", url: "file7.jpg" } ];

var assets:Dictionary = new Dictionary();

var bulkLoader:BulkLoader = new BulkLoader( "bulkLoader" );

for ( var i:int = files.length - 1; i >= 0; i-- )
{
    bulkLoader.add( files[ i ].url, { id: files[ i ].id } );
    bulkLoader.get( files[ i ].id ).addEventListener( Event.COMPLETE,
completeHandler );
}

function completeHandler( $event:Event ) : void
{
    var key:String = ( $event.target as LoadingItem ).id;
    assets[ key ] = bulkLoader.getBitmapData( key, true );
    trace( "LOADED: " + bulkLoader.itemsLoaded );
}

bulkLoader.start( 3 );

What is the expected output? What do you see instead?
Instead of:

LOADED: 1
LOADED: 2
LOADED: 3
LOADED: 4
LOADED: 5
LOADED: 6
LOADED: 7

I get:

LOADED: -1
LOADED: -2
LOADED: -3

What version of the product are you using? On what operating system?
BulkLoader-rev239 
OS: all

Please provide any additional information below.

As you can see the number of files loaded is the same as the number of
connections passed in start() method

Major issue is that, not all queue is loaded.

Original issue reported on code.google.com by jakub.go...@gmail.com on 16 Feb 2009 at 1:18

GoogleCodeExporter commented 9 years ago
Hi Jakub.

Thanks for the heads up. This is fixed on revision 269. From the log message:
Fixed issue #75, where removing an item inside a complete handler would cause 
the loader to stale.

If an item was removed inside it's individual COMPLETE handler, the 
bulkLoader.loadedItems would be bogus 
(this was an easy fix), but also if that would happen inside on the last item 
on from the connection queue, the 
queue would stale. Thanks Jakub Gondek for the report.

Original comment by debert on 27 Apr 2009 at 3:28