Hello!
I posted in another mail that I had a problem with this code:
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 was trying to use Event.observe as it is recommended but it just
didn''t
work.
I chaged the part of the Event.observe to
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
}.bind(this);
And now this all works. I finally see the Hello
Did I do something wrong on the Event.observe?? Can someone just explain
this to me please!!
Thanks :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
On Dec 1, 2007, at 4:58 AM, Antonio CS wrote:> Did I do something wrong on the Event.observe?? Can someone just > explain this to me please!!In any of these Event based things, you always drop the ''on'' when describing the event you want to observe: onchange: Event.observe(''change''... onblur: Event.observe(''blur''... Etc. Walter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 1, 2007, at 9:52 AM, Walter Lee Davis wrote:> Event.observe(''change''...Well, to be pedantic about it, http://prototypejs.org/api/event#method-observe Event.observe(element, eventName, handler[, useCapture = false]) Walter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the reply! Really forgot about the ''on'' thing :( On Dec 1, 2007 2:58 PM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> > > On Dec 1, 2007, at 9:52 AM, Walter Lee Davis wrote: > > > Event.observe(''change''... > > > Well, to be pedantic about it, > > http://prototypejs.org/api/event#method-observe > > Event.observe(element, eventName, handler[, useCapture = false]) > > Walter > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---