Hey there,
Your code is rather well done for someone new to Prototype/SAU, and I
commend you for it. However, the end of your constructor has me puzzled:
> setInterval('this.shownext', 5000);
> this.pe = new PeriodicalExecuter(this.shownext,
> this.options.slidetime);
1) Why the heck do you use a setInterval, since you use a PE? This
appears to be useless, and will become confusing when you get multiple
calls...
2) By passing your shownext method unbound, you lose its "this" meaning
when it gets called. At that time, "this" will refer to the default
object: the window object. So naturally, you don't get your fields back.
Solution: use a bound call:
this.pe = new PeriodicalExecuter(this.shownext.bind(this),
this.options.slidetime);
For further details and live examples, see:
http://prototypejs.org/api/function/bind
Your shownext function also has a few issues...
> if(this.currentbuffer == 0) {
OK, this is true on start, but I fail to see any code, anywhere, that
changes this.currentbuffer to be something else. Besides, if you're
just using it as a toggler, use an explicit boolean instead.
> Effect.FadeOut(visiblebuffer);
> Effect.FadeIn(hiddenbuffer);
Proper effect usage mandates creating new effects instead of calling
them "statically" like this:
new Effect.FadeOut(visiblebuffer);
new Effect.FadeIn(hiddenbuffer);
'HTH
--
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---