Loading of wrong frame due to slow reply from server

Hi,
I am working on an application having its front end in Flash.
I experience a rare problem as explained below. In some location, where the application is used, when authentication of a user happens, the JSP which embeds the flash .swf file is called.
In the .fla file, the initial frames have actionscript coding which says if sessionid is not null, then go to frame “Loading”, otherwise play the animation.
Now once the user authentication is success, the .fla file loads again and in some systems insted of going to “Loading” frame it plays the animation in initial frames and then go to loading.
How can I avoid this. This happens only in some systems where reply from server is very slow.
The asction script is getting values from XML file.
It gets the correct value but still, wrong farme loads.
The correct working is that loading frame should load once authentication is success.

This problem appears only in few systems and cannot be replicated always.

Please let me know if you know how to resolve this.

Nans