Re: [Proto-Scripty] this and setTimeout in Prototype-based class

2009-12-04 Thread Christophe Decaux
Hi there, IMHO, Ajax wouldn't help as the real timing issue is around the image load which I don't think is predictable. So, why don't you use a image preload mechanism such as the one I use in a slightly different way. I display a waiting message, preload the pic and then hide the waiting

Re: [Proto-Scripty] this and setTimeout in Prototype-based class

2009-12-04 Thread Daan Mortier
To pass a function to setTimeout that is binded to an object of choice, to something along these lines: // where obj is obviously your object var func = function() { this.doSomething() }.bind( this ); window.setTimeout( func, 1000 ); Function.prototype.bind is a function that's defined in

Re: [Proto-Scripty] this and setTimeout in Prototype-based class

2009-12-04 Thread Daan Mortier
I'm sorry, I made some typos. This is correct: // where obj is obviously your object var func = function() { this.doSomething() }.bind( obj ); window.setTimeout( func, 1000 ); Daan On Thu, Dec 3, 2009 at 15:28, Daan Mortier daanmort...@gmail.com wrote: To pass a function to setTimeout

Re: [Proto-Scripty] this and setTimeout in Prototype-based class

2009-12-03 Thread Peter De Berdt
On 02 Dec 2009, at 15:25, fma wrote: But it does not work. In the _show() method, the call to this._flashNavButtons() leads to an error (this._flashNavButtons() is not a function). I think I understand why: when called from the timeout mecanism, 'this' no longer exists, or does not point