Closed GoogleCodeExporter closed 9 years ago
Hi Kevin.
Thanks for the report (and patch).
I can't really reproduce the error your are getting. If I understand you
correctly,
you are doing something like:
import br.com.stimuli.loading.*;
var b : BulkLoader = new BulkLoader("main", 3 , 1);
b.add("http://www.emptywhite.com/bulkloader-assets/shoes.jpg", {id:"cats"});
b.addEventListener(BulkLoader.COMPLETE, onAllDone);
b.start();
function onAllDone(evt : Event) :void{
trace("on all done");
//b.addEventListener(BulkLoader.COMPLETE, onAllDone2);
b.removeEventListener(BulkLoader.COMPLETE, onAllDone);
b.add("http://www.emptywhite.com/bulkloader-assets/shoes.jpg", {id:"shoes"});
// if a new start isn't called, nothing will happend, which makes sense.
// else the loading resumes and is finished as expected.
b.start();
}
function onAllDone2(evt : Event):void{
trace("final loading is done");
}
I've committed a new revision that changes a little the timing where COMPLETE
fires,
maybe using that will help?
In the code above, it seems to work as expected, if the second start isn't
called,
the loader is "paused", else it resumes loading and when all items are loaded,
it
will start loading again.
Regarding your patch, I am weary of applying it since I can't reproduce the
error you
are seeing.
Unrelated: did you have to modify the source for getting FDT to work with
BulkLoader?
They had a parsing bug that wouldn't accept the static initializing on line
202 in
LoadingItem. They said they would fix it, but since I am not a FDT user, I
can't know
for sure.
Thanks
Arthur
Original comment by debert
on 12 Jan 2008 at 4:29
Original comment by debert
on 12 Jan 2008 at 4:29
Hi Arthur,
Yes - that is basically the situation I was in. The only difference I can see
is that
I was loading XML. I will see if I can get together a simplified test case which
illustrates the problem (if your recent change didn't fix it).
Re. FDT, it is still reporting errors. I compiled a swc of BulkLoader so that I
can
link it in without FDT making me think there are errors in my project
constantly...
I'll try and provide an example of the problem soon,
Thanks,
Kelvin (not Kevin!)
Original comment by kelvin.l...@gmail.com
on 12 Jan 2008 at 5:39
OK - I figured out the problem... It is a little more complex than I first
suggested.
It is to do with passing true to the clearMemory parameter while in a complete
listener and then immediately adding something else to the queue...
Here is a class which illustrates the problem:
<code><pre>
package
{
import flash.events.Event;
import br.com.stimuli.loading.BulkLoader;
import flash.display.Sprite;
/**
* @author Kelvin Luck
*/
public class BulkLoaderTest extends Sprite
{
public static const LOADER_NAME:String = 'myLoader';
public function BulkLoaderTest()
{
var loader:BulkLoader = new BulkLoader(LOADER_NAME);
loader.add('second.xml');
loader.get('second.xml').addEventListener(BulkLoader.COMPLETE, onSecondComplete);
loader.start();
}
private function onSecondComplete(event:Event):void
{
trace ('onSecondComplete');
var loader:BulkLoader = BulkLoader.getLoader(LOADER_NAME);
// removing the "true" for "clearMemory" prevents the error
var data:XML = loader.getXML('second.xml', true).filename[0];
var filename:String = data.@name.toString();
loader.add(filename);
loader.get(filename).addEventListener(BulkLoader.COMPLETE, onThirdComplete);
// uncommenting out the following line stops the error...
//loader.start();
}
private function onThirdComplete(event:Event):void
{
trace ('onThirdComplete');
}
}
}
</pre></code>
(I've also attached a zip with this class, the latest BulkLoader and the demo
XML files).
By the way, the triggered error is:
<code><pre>
[Fault] exception, information=TypeError: Error #1009: Cannot access a property
or
method of a null object reference.
Fault, loadNext() at BulkLoader.as:634
634 _connections.forEach(function(i : LoadingItem, ...rest) : void{
</pre></code>
Cheers,
Kelvin :)
Original comment by kelvin.l...@gmail.com
on 12 Jan 2008 at 6:12
Attachments:
Hi Kelvin (sorry about the Kevin).
I am looking into this in more detail. This is a bug really, and as soon as I
have a
fix I'll let you know.
I know that this might simply not apply, but you can create a LazyXMLLoader
that will
instantiate a bulk loader from a "serialized" info in an xml file. The current
download zip has an example of how this work and might help you out on this
particular case.
Thanks,
Arthur
ps1: I am working on a json backend for external BulkLoader instances
ps2: I **love** jquery.
Original comment by debert
on 12 Jan 2008 at 6:37
Hi,
Cool - thanks for confirming the bug. I'm not desperate for a fix because I am
just
calling start on the queue immediately to avoid the issue but it will probably
save
others some confusion...
I didn't know about LazyXMLLoader but I'll check that out for future use... I
think
it's a bit too late for this project which is already mostly coded (and the
version
above is a very stripped down version of my code!).
Cheers,
Kelvin :)
ps: Yeah - jquery rocks. I just made a couple of plugins for it...
Original comment by kelvin.l...@gmail.com
on 14 Jan 2008 at 8:51
This is fixed in revision 114.
The issue really was that the first time the onAllLoaded ran, it set the
connections
to null, which would later throw an error.
Thanks for hunting this one down.
[]s
Arthur Debert
Original comment by debert
on 5 Feb 2008 at 2:53
[deleted comment]
Hi,
i think i have the same problem with revision 206 (0.9.9.4).
I try to load an .swf (about 300KB) and i can't get the file. getContent("...")
and
getMovieClip() returns 'null'.
I have attachted the file with the code. If you like to try it - you have to
put the
url of the swf into the 'add'-method.
thanks,
Henk
Original comment by henk.bla...@googlemail.com
on 29 Apr 2008 at 4:15
Attachments:
[deleted comment]
sorry for the last post - i think it was the .swf i tried to load - not the
bulk loader!
i have rebuild the .fla and now it works.
Original comment by henk.bla...@googlemail.com
on 30 Apr 2008 at 6:37
Original issue reported on code.google.com by
kelvin.l...@gmail.com
on 8 Jan 2008 at 5:06Attachments: