Problem with MassLoad lib and Complete Event

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with MassLoad lib and Complete Event

Bastien Levasseur
Hi
I try to use massload lib to make a moduleManager for a personal haxe application :

class ModuleManager{
   
    private var massLoader                    :MassLoader;

    public function new()  {
        this.massLoader     = MassLoader.getInstance(true);
    }
   
    public function loadModules(modulesList:Array<Dynamic>):Void {
        var modulesGroup:ILoadFile =     if(modulesList.length >1){
            LoadFileCreator.create( { files:modulesList, name:"modules" } );
        }else {
            if (modulesList.length == 1) {
                LoadFileCreator.create(  modulesList[0] );
            }else {
                throw "Modules array is empty";
            }
        }
        modulesGroup.addEventListener(MassLoaderEvent.PROGRESS, this.log);
        modulesGroup.addEventListener(MassLoaderErrorEvent.ERROR, this.log);
        modulesGroup.addEventListener(MassLoaderEvent.COMPLETE, this.log);

       this.massLoader.addFile(modulesGroup);
    }
      
    private function log(evt:Event):Void { trace(evt); }
   
}

So I've got the progress event but never complete or error event.
If someone has already got this problem and fix it or has a solution, I will be very happy to share it with him :D.

Thanks.

LEVASSEUR Bastien


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with MassLoad lib and Complete Event

Fabien ANTOINE
Hi,

I tried you class and I got progress and complete events when I try to
load one or more files...
Can you send me a full code example with the issue? I'll try to solve it
quickly.

Fabien


Bastien Levasseur a écrit :

> Hi
> I try to use massload lib to make a moduleManager for a personal haxe
> application :
>
> class ModuleManager{
>    
>     private var massLoader                    :MassLoader;
>
>     public function new()  {
>         this.massLoader     = MassLoader.getInstance(true);
>     }
>    
>     public function loadModules(modulesList:Array<Dynamic>):Void {
>         var modulesGroup:ILoadFile =     if(modulesList.length >1){
>             LoadFileCreator.create( { files:modulesList,
> name:"modules" } );
>         }else {
>             if (modulesList.length == 1) {
>                 LoadFileCreator.create(  modulesList[0] );
>             }else {
>                 throw "Modules array is empty";
>             }
>         }
>         modulesGroup.addEventListener(MassLoaderEvent.PROGRESS, this.log);
>         modulesGroup.addEventListener(MassLoaderErrorEvent.ERROR,
> this.log);
>         modulesGroup.addEventListener(MassLoaderEvent.COMPLETE, this.log);
>
>        this.massLoader.addFile(modulesGroup);
>     }
>      
>     private function log(evt:Event):Void { trace(evt); }
>    
> }
>
> So I've got the progress event but never complete or error event.
> If someone has already got this problem and fix it or has a solution,
> I will be very happy to share it with him :D.
>
> Thanks.
>
> LEVASSEUR Bastien
>
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with MassLoad lib and Complete Event

Bastien Levasseur
In reply to this post by Bastien Levasseur
For my application I need to load just swfs.
I had perhaps a solution, I must add the content property of the ILoadFile to the scene when the type is FileType.Loader.


I tried my class with this code :

var modulesList:Array<Dynamic> = [{file:"./modules/test1.swf",name:"test1"}, {file:"./modules/test2.swf",name:"test2"}];
var moduleManager:ModuleManager = new ModuleManager();
moduleManager.loadModules(modulesList);

And when I add the loader on the scene I receive the complete event.

Thanks

LEVASSEUR Bastien


--- En date de : Mer 19.11.08, Fabien ANTOINE <[hidden email]> a écrit :
De: Fabien ANTOINE <[hidden email]>
Objet: Re: [haXe] Problem with MassLoad lib and Complete Event
À: "The haXe compiler list" <[hidden email]>
Date: Mercredi 19 Novembre 2008, 19h18

Hi,

I tried you class and I got progress and complete events when I try to load one
or more files...
Can you send me a full code example with the issue? I'll try to solve it
quickly.

Fabien


Bastien Levasseur a écrit :
> Hi
> I try to use massload lib to make a moduleManager for a personal haxe
application :
>
> class ModuleManager{
> private var massLoader :MassLoader;
>
> public function new() {
> this.massLoader = MassLoader.getInstance(true);
> }
> public function loadModules(modulesList:Array<Dynamic>):Void
{
> var modulesGroup:ILoadFile = if(modulesList.length >1){
> LoadFileCreator.create( { files:modulesList,
name:"modules" } );
> }else
{
> if (modulesList.length == 1) {
> LoadFileCreator.create( modulesList[0] );
> }else {
> throw "Modules array is empty";
> }
> }
> modulesGroup.addEventListener(MassLoaderEvent.PROGRESS, this.log);
> modulesGroup.addEventListener(MassLoaderErrorEvent.ERROR,
this.log);
> modulesGroup.addEventListener(MassLoaderEvent.COMPLETE, this.log);
>
> this.massLoader.addFile(modulesGroup);
> }
> private function log(evt:Event):Void { trace(evt); }
> }
>
> So I've got the progress event but never complete or error event.
> If someone has already got this problem and fix it or has a solution, I
will be very happy to share it with him :D.
>
> Thanks.
>
> LEVASSEUR Bastien
>
>


-- haXe -
an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org