problem when changing to a new page from the animation.complete event

On a web app i’ve got a login page that is the default page of the program. If you’ve got a valid cookie set then it never shows any controls it just validates that cookie data and then does a show for the main page of the app. If the cookie is not valid or not there then it shows it’s login controls for you to enter the password. For the longest time there was a very annoying bug that I couldn’t sort out that if you had a saved cookie it would work perfectly, but if you had to enter the password then you’d get a page full of javascript errors when trying to load the main page. maybe 4 out of 5 times it would fail to load at all but the 5th time you could dismiss the javascript error and the rest of the page would seem to be working, at least enough to save it’s logged in cookie to avoid errors in the future.

Today that reached the top of my list again and it turns out to be a problem with the animation.complete event. I was using an animation to fade out the login controls to signify that something worked and then in the completion event I was doing a .show for the main page. Thats what caused the error. If I did the show directly where I started the animation then it worked perfectly. Also if I created a web timer with it’s mode set to 1 in the animation.complete event and let the timer event show the new page that also worked fine.

I’m not sure even how to open a bug report for this, but there is definitely something different about the timing that the animation.complete event calls into vs all the other controls. If you’re having trouble showing a new page after an animation on a page then this is likely the issue. I can’t seem to duplicate it in a simple app, it’s only when the page you’re showing starts to be complex and has a lot of controls that it shows up as a problem.

The AnimationComplete event probably fires on the main thread (I’m not near my computer to verify), outside of the context of a session. Try creating a WebSessionContext object at the top of that event and see if that helps.