Heya I''m making a class which does a thing or two:) Inside my initialize function I have the following lines of code: this.eventMouseMove = this.mouseMove.bindAsEventListener(this); Event.observe(document.body, ''mousemove'', this.eventMouseSelect); And of course a function named mouseMove; The problem is that I''m getting tons of ''$A is not defined'' if I move my mouse while loading the page. The class is initialized on onload. The class works just fine after the page finished loading. I tried moving the two lines of code around to different places in my page. But nothing helps. Annyone out there know what I''m doing wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Simply place those two lines in a function that''s attached to the page''s onload event, therefore the mouse events will only be caught once everything is initialized. On 10/4/06, Muskel A <me-Veb2yxRwxBdBDgjK7y7TUQ@public.gmane.org> wrote:> > > Heya > I''m making a class which does a thing or two:) > > Inside my initialize function I have the following lines of code: > > this.eventMouseMove = this.mouseMove.bindAsEventListener(this); > Event.observe(document.body, ''mousemove'', this.eventMouseSelect); > > And of course a function named mouseMove; > > The problem is that I''m getting tons of ''$A is not defined'' if I move > my mouse while loading the page. The class is initialized on onload. > The class works just fine after the page finished loading. I tried > moving the two lines of code around to different places in my page. But > nothing helps. > > Annyone out there know what I''m doing wrong? > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-954-9798 x2903 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Muskel, Muskel A a écrit :> Heya > I''m making a class which does a thing or two:)How specific :-)> Inside my initialize function I have the following lines of code: > > this.eventMouseMove = this.mouseMove.bindAsEventListener(this); > Event.observe(document.body, ''mousemove'', this.eventMouseSelect);"this.eventMouseMove" I guess, uh?> The problem is that I''m getting tons of ''$A is not defined'' if I move > my mouse while loading the page. The class is initialized on onload. > The class works just fine after the page finished loading. I tried > moving the two lines of code around to different places in my page. But > nothing helps.I''ve run into this before, but can''t remember to what exactly it''s due. It *is* an initialization issue. First of all, CHECK that your script is loaded *after* Prototype''s JS. Second, if this isn''t enough, please provide a minimal reproduceable case online for us to check out. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m making a javascript scroller. Just for the fun of it. Prototype is loaded before, you can ses the script in action here: http://beta.myshots.dk/slider.html And my class here: http://beta.myshots.dk/js/scroller.js --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
''K, this works in my FF. Under what circumstances exactly do you get your error? Muskel A a écrit :> Prototype is loaded before, you can ses the script in action here: > http://beta.myshots.dk/slider.html-- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m also using FF. Try moving the mouse around and press F5 while you are doing it. Then you will get a ton of the ''$A is not defined'' errors. The script is working fine and just liked to get rid of all those errors. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey, Muskel A a écrit :> I''m also using FF. > Try moving the mouse around and press F5 while you are doing it. Then > you will get a ton of the ''$A is not defined'' errors. The script is > working fine and just liked to get rid of all those errors.OK, that''s nominal then. But first, why would the user refresh the page WHILE scrolling your contents? Now, you won''t have this error in IE, because in IE, Prototype automatically unregisters all event handlers on page unload. What you need to do is exactly this, so that your dragging ceases at page unload, preventing its handlers to keep working on the reloading page before its initialization is complete. Try appending this to your script: Event.observe(window, ''unload'', Event.unloadCache, false); This should help. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Worked like a charm. Thanks a lot! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Worked like a charm. Thanks a lot! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---