omg! I dont want to do that. the class i have i want to create and then add stuff to it by using the methods in it. i need to be able to run them seperatly. i already know it works if i call them in the same addEvent call...i need to be able to call them in seperate addEvent calls
_____ From: Thierry bela nanga [mailto:[email protected]] Sent: Sunday, 6 December 2009 3:37 AM To: [email protected] Subject: Re: [Moo] addEvent sequence in IE got it! formValidator is not in the window scope, that what you got that message put (function() {formValidator.boo()}).delay(2000); in the same function: window.addEvent("load", function () { formValidator = new MooFormValidator(new Element("div"), {}); (function() {formValidator.boo()}).delay(2000); }); On Sat, Dec 5, 2009 at 5:31 PM, Steve Onnis <[email protected]> wrote: the error is that "formValidator" is undefined which is telling me that the first load event has not happened or that are happening not in the order they are being defined. in my actual code i am referencing an actual element on the page and the same error occurs the only way so far i have managed to get around it is to do this which i would prefer not to window.addEvent("load", function () {formValidator = new MooFormValidator(new Element("div"), {});}); (function() {formValidator.boo()}).delay(2000); _____ From: Thierry bela nanga [mailto:[email protected]] Sent: Sunday, 6 December 2009 3:23 AM To: [email protected] Subject: Re: [Moo] addEvent sequence in IE try to inject your element in the dom first, I have not tested it but IE sometimes throw errors on some methods when the element is not in the dom. this could happen if for example you try to get coordinates, On Sat, Dec 5, 2009 at 5:00 PM, Steve Onnis <[email protected]> wrote: Your example doesn't work The issue I am having is in IE -----Original Message----- From: Oskar Krawczyk [mailto:[email protected]] Sent: Sunday, 6 December 2009 2:58 AM To: [email protected] Subject: Re: [Moo] addEvent sequence in IE You need to define the variable. http://mooshell.net/u/oskar/V924A/8/ On 5 Dec 2009, at 13:12, Steve Onnis wrote: > I am having a little trouble with something i am working on which for some > reason works in FireFox but not in IE > > Is there a squence on which the addEvent actions are run on the window > object? > > Take the following Class for example > > var MooFormValidator = new Class({ > Implements : [Events, Options], > options : {}, > initialize : function (element, options) {}, > boo : function () {alert("hello");} > }); > > > // This errors in IE saying that "formValidator" is undefined > // http://mooshell.net/V924A/6/ > window.addEvent("load", function () { > formValidator = new MooFormValidator(new Element("div"), {}); > }); > window.addEvent("load", function() { > formValidator.boo() > }); > > // Where as the following works fine > http://mooshell.net/V924A/7/ > window.addEvent("load", function () { > formValidator = new MooFormValidator(new Element("div"), {}); > formValidator.boo() > }); > > > Anyone explain to me why this is happening? And how I can overcome it? > > Steve > -- http://tbela99.blogspot.com/ fax : (+33) 08 26 51 94 51 -- http://tbela99.blogspot.com/ fax : (+33) 08 26 51 94 51
