Hi,

> I want to use the Effect.Opacity effect; what is the best way to implement
> this? Should I bind my _opacity() function to the buttons, using methodize?

First check that scripty hasn't already done that (without the
underscore). Scripty methodizes effects (at least sometimes, I don't
know the details), so that (for instance) Effect.Fade can be used as a
#fade method on element instances.

If you want to call a global function on each entry in an array,
that's easy:

    this._navButtons.each(function(item) {
        _opacity(item, ...);
    });

You might consider the Effect.Parallel effect, though, if you're
looking to do effects in parallel:
http://wiki.github.com/madrobby/scriptaculous/effect-parallel

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 8, 10:25 am, Frédéric <[email protected]> wrote:
> Le mardi 8 décembre 2009 10:07, T.J. Crowder a écrit :
>
> > I assume in your real code, that ends with `]`, not with `)` as above?
> > As above, it's a syntax error.
>
> > > this._navButtons.invoke("_opacity", {'from': 0,
> > >                                      'to': 1,
> > >                                      'duration':1});
>
> Oh, yes, my real code is correct...
>
> > Do your button instances have a function called `_opacity` (with the
> > underscore)? I'm not a scripty-head and maybe I shouldn't be posting,
> > but the effect is called Effect.Opacity, and usually when scripty
> > mixes effects in as element methods, it's the name of the effect with
> > an initial lower case letter, so wouldn't that just be `opacity`?
>
> Ok, I see the problem: here, _opacity() is a global function, not a
> this._navButtons element method...
>
> I want to use the Effect.Opacity effect; what is the best way to implement
> this? Should I bind my _opacity() function to the buttons, using methodize?
>
> --
>    Frédéric

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.


Reply via email to