If an effect is set to take 2 seconds to run and I want to execute a function after it''s finished, should I just use a setTimeout call? Or is there a better way? I know about the Effects queue, but it appears that only works for calling other Effects. Thank you! Daniel
I believe all of the scriptaculous effects have an afterFinish callback. I''d suggest using that instead of a timeout. More info here: http://wiki.script.aculo.us/scriptaculous/show/CoreEffects Cheers -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Daniel Elmore Sent: Wednesday, August 09, 2006 6:22 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Timing things with Effects If an effect is set to take 2 seconds to run and I want to execute a function after it''s finished, should I just use a setTimeout call? Or is there a better way? I know about the Effects queue, but it appears that only works for calling other Effects. Thank you! Daniel _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Try the afterFinish handler.
ex:
new Effect.Fade(''progressDiv'',{duration:2.5,
afterFinish:function(){ //do something } });
Thanks,
Irfan
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On
Behalf Of Daniel
Elmore
Sent: Wednesday, August 09, 2006 3:52 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails-spinoffs] Timing things with Effects
If an effect is set to take 2 seconds to run and I want to execute a
function after it''s finished, should I just use a setTimeout call? Or
is
there a better way?
I know about the Effects queue, but it appears that only works for calling
other Effects.
Thank you!
Daniel
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Use the ''afterFinish'' option.
http://wiki.script.aculo.us/scriptaculous/show/CoreEffects
Example:
new Effect.Opacity(''my_element'',
{ duration: 2.0,
transition: Effect.Transitions.linear,
from: 1.0, to: 0.0,
afterFinish: function (obj) {obj.element.parentNode.removeChild
(obj.element);}
});
TAG
On Aug 9, 2006, at 4:21 AM, Daniel Elmore wrote:
> If an effect is set to take 2 seconds to run and I want to execute a
> function after it''s finished, should I just use a setTimeout call?
> Or is
> there a better way?
>
> I know about the Effects queue, but it appears that only works for
> calling
> other Effects.
>
> Thank you!
>
> Daniel
>
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks Joe, that''s what I needed. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Bauser, Joseph (Joe) Sent: Wednesday, August 09, 2006 7:47 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Timing things with Effects I believe all of the scriptaculous effects have an afterFinish callback. I''d suggest using that instead of a timeout. More info here: http://wiki.script.aculo.us/scriptaculous/show/CoreEffects Cheers -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Daniel Elmore Sent: Wednesday, August 09, 2006 6:22 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Timing things with Effects If an effect is set to take 2 seconds to run and I want to execute a function after it''s finished, should I just use a setTimeout call? Or is there a better way? I know about the Effects queue, but it appears that only works for calling other Effects. Thank you! Daniel _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs