Re: [Proto-Scripty] Re: Problem using invoke()

2009-12-09 Thread Frédéric
Le mardi 8 décembre 2009 15:43, T.J. Crowder a écrit :

       this._navButtons.each(function(item) {
           _opacity(item, ...);
       });
 
  The problem is to give additionnal params (for Effect.Oppacity); it
  does not seem to be possible with each(). That's why I tried
  invoke()...

 Look again at my example. You'd fill in the ... with the parameters.

Thanks, I got it.

-- 
   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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread T.J. Crowder
Hi,

 this._navButtons = [this._view.prevButton,
 this._view.nextButton,
 this._view.hideButton);

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});

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`?

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


On Dec 7, 9:44 pm, Frédéric f...@gbiloba.org wrote:
 Hi,

 I build an array with some DOM elements, and try to apply effects on them
 using invoke(). But it does not work.

 Ie may be a problem with function defined as pesudo-methods, but I don't
 get any usefull error neither in Firebug, nor in IE debugger.

 As I want to use Effect.Opacity(), I wrote a pure function as:

 function _opacity(el, args) {
     new Effect.Opacity(el, args);

 }

 then in my class:

 this._navButtons = [this._view.prevButton,
                     this._view.nextButton,
                     this._view.hideButton);
 this._navButtons.invoke(_opacity, {'from': 0,
                                      'to': 1,
                                      'duration':1});

 In Firebug, I get:

 reference to undefined property this[arguments[0]]
 [Break on this error]

 without any traceback or code line. In IE, I get:

 'undefined' a la valeur null ou n'est pas un objet
 ('undefined' as null value or is not an object)

 at line 713 of prototype.js; it is the call to my method:

     return value[method].apply(value, args);

 What I did wrong? Is it a problem with this context?

 --
     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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




Re: [Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread Frédéric
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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




Re: [Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread Frédéric
Le mardi 8 décembre 2009 10:36, T.J. Crowder a écrit :

 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.

It does not seem to be the case with the Opacity effect..

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

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

The problem is to give additionnal params (for Effect.Oppacity); it does not 
seem to be possible with each(). That's why I tried invoke()...

 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

I only need 1 effect on several elements. I also tried Effect.multiple, but 
the effect is not synchronized on all objects. Neither with a simple loop, 
but the delay is very small in this last case (I can't see it)...

-- 
   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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread T.J. Crowder
Hi,

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

 The problem is to give additionnal params (for Effect.Oppacity); it does not
 seem to be possible with each(). That's why I tried invoke()...

Look again at my example. You'd fill in the ... with the parameters.

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


On Dec 8, 11:23 am, Frédéric f...@gbiloba.org wrote:
 Le mardi 8 décembre 2009 10:36, T.J. Crowder a écrit :

  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.

 It does not seem to be the case with the Opacity effect..

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

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

 The problem is to give additionnal params (for Effect.Oppacity); it does not
 seem to be possible with each(). That's why I tried invoke()...

  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

 I only need 1 effect on several elements. I also tried Effect.multiple, but
 the effect is not synchronized on all objects. Neither with a simple loop,
 but the delay is very small in this last case (I can't see it)...

 --
    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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.