Re: Calling class method from PeriodicalExecuter

Antonio CS
Fri, 30 Nov 2007 23:34:43 -0000

I have another problem!

I have this inside the class''s method:

paths.each(
                function(img, i) {
                    this.imglist[i] = new Image();
                    this.imglist[i].src = img;

                    Event.observe(
                                  this.imglist[i],
                                  ''onload'',
                                  function() {
                                        alert("Hello");
                                        this.imglist[i].style.display
="none";
                                        this.imglist[thelastone].push(i);
//quando a imagem acabar de carregar vai adicionar o seu numero
                                  }.bindAsEventListener(this));
    //de index a ultima casa do array que contem as imagens todas


                }.bind(this)
            );

I think the this is getting binded to the this of the class in the each but
not in the function I set in the onload event.
I am running this on my local machine so the images load very quickly, but
the onload event never fires (I never see a hello box)

Can anyone help me out here please?