PDA

View Full Version : Side Effect with Animation v1.0a2



mikegiddens
26 Feb 2007, 3:37 PM
I was changing up some code and wanted to point this out to see if this is an issue.

This snip works great. Props for the inline animation.


Ext.get('error').hide().update(response.errorMessage).slideIn("t").pause(2).slideOut("t");


but it had side effect when I put



Ext.get('error').hide().update(response.errorMessage).slideIn("t").pause(2).slideOut("t").update("");


with the update at the end it never shows any code. and doesn't react to the pause.

or



Ext.get('error').hide().update(response.errorMessage).slideIn("t").pause(2).slideOut("t").hide();


uses the pause but never shows the text until it slides out.

If I am not using this right then could someone please advise. If this is a bug then I hope this helps.

Tested in: IE7, FireFox

brian.moeskau
26 Feb 2007, 7:34 PM
At the moment, it is slightly confusing, but you cannot chain just any Element methods together with effects like that. The reason is that only the Fx methods go through the internal effects queue so that they get sequenced correctly. Adding non-Fx method calls (like update) in the chain can have unexpected results.

One thing you can do is pass a callback into the effects methods, so you might try adding a separate function (it can be anonymous) that does your final update, and pass that in as the callback to your last effect so that it gets called after the slideOut completes.

We'll be sure to clarify this limitation once the docs have been updated.