> 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:
Thanks, I've been toying with this framework behind the scenes for a short
while now learning from others, but have been doing raw javascript for
years. Been a while since I put my JS hat on though so I'm a bit rusty.
>
> > 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...
>
Yep, useless indeed... Just a leftover from trying various things, removed
it just after posting.
> 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);
>
Nicolas filled me in on that one... I understand now.
> 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.
Yep, spotted that one just after posting too.
>
> > 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);
Not only that but they should be Effect.Fade and Effect.Appear respectively
and I'm not passing the fadetime. That's cleared up why the fade isn't
working though.
Thanks for the advice, what a nice group this is ;)
Tim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---