I have a solution to this problem, but I''d like to know if there is a more common solution that doesn''t require modifications to the Effects code. I wonder if I''m doing something that made a non-problem a problem. Almost any of the Scripts demos have a race condition... if the script is called again (new instance of the effect), before the first instance completes, the final element may have different characteristics than the original. A good demo of this is the Effects.Highlight http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo Note the color of the element on page load. Click several times, being sure to click while the highlight is in progress. The final color of the element will not match the original. Subsequent instances of the Highlight effect have captured the background color "in progress" and restored the final background color to the "in progress" color. I had to add code to gate requests to Highlight when in progress. It required a modification to Highlight to callback on completion to open the gate. Sam _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Sam, if you''re using it ''anonymously'' you could try queueing, like new Effect.Highlight(element, { queue: ''end'' }); Or saving the object to a variable, checking if it exists, and cancelling it: var eff; function highlightit(element) { if(eff) eff.cancel(); eff = new Effect.Highlight(element); } On 6/10/06, Sam <sam.google-Uc2IQQBAS6sAvxtiuMwx3w@public.gmane.org> wrote:> > > I have a solution to this problem, but I''d like to know if there is a more > common solution that doesn''t require modifications to the Effects code. I > wonder if I''m doing something that made a non-problem a problem. > > Almost any of the Scripts demos have a race condition... if the script is > called again (new instance of the effect), before the first instance > completes, the final element may have different characteristics than the > original. > > A good demo of this is the Effects.Highlight > > http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo > > Note the color of the element on page load. Click several times, being sure > to click while the highlight is in progress. The final color of the element > will not match the original. Subsequent instances of the Highlight effect > have captured the background color "in progress" and restored the final > background color to the "in progress" color. > > I had to add code to gate requests to Highlight when in progress. It > required a modification to Highlight to callback on completion to open the > gate. > > Sam > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
Effects are not designed to be aware of other effects going on, so please see the queing/cancelling tipps in Ed''s answer. -Thomas Am 10.06.2006 um 14:17 schrieb Sam:> I have a solution to this problem, but I''d like to know if there is > a more common solution that doesn''t require modifications to the > Effects code. I wonder if I''m doing something that made a non- > problem a problem. > > Almost any of the Scripts demos have a race condition... if the > script is called again (new instance of the effect), before the > first instance completes, the final element may have different > characteristics than the original. > > A good demo of this is the Effects.Highlight > > http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo > > Note the color of the element on page load. Click several times, > being sure to click while the highlight is in progress. The final > color of the element will not match the original. Subsequent > instances of the Highlight effect have captured the background > color "in progress" and restored the final background color to the > "in progress" color. > > I had to add code to gate requests to Highlight when in progress. > It required a modification to Highlight to callback on completion > to open the gate. > > Sam > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs-- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs