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 <[EMAIL PROTECTED]> 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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs