You have some asynchronous events here, each being triggered  
separately, and the results are chaotic.

Try this:

function update_clock() {
        Effect.Fade('clock',
                afterFinish:function(){
                        new Ajax.Updater('clock',
                                'clock.py',{
                                        onComplete:function(){
                                                Effect.Appear('clock');
                                        }
                                }
                        );
                }
        );
}

You could also investigate effect queues, but I think this sort of  
chained function will do you better.

Walter

On Oct 4, 2009, at 11:26 AM, LinkMaster03 wrote:

>
> What I am trying to accomplish is a clock that updates every five
> seconds. Before it updates I want it to fade out, and after it updates
> I want it to fade back in. This is what I have right now:
>
> <html>
> <head>
>    <script type="text/javascript" src="prototype.js"></script>
>    <script type="text/javascript" src="scriptaculous.js"></script>
>    <script type="text/javascript">
>        function update_clock() {
>            Effect.Fade('clock');
>            new Ajax.Updater('clock', 'clock.py');
>            Effect.Appear('clock');
>        }
>
>        new Ajax.Updater('clock', 'clock.py');
>        new PeriodicalExecuter(update_clock, 5);
>    </script>
> </head>
> <body>
>    <div id="clock"></div>
> </body>
> </html>
>
> What happens when I open that page is odd. The clock updates, fades
> in, then fades out until the next update. What am I doing wrong?
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to