Hi,
I am learning game type animations using a pong-style tutorial: http://as3gametuts.com/2011/03/19/pong-1/
Source FLA: https://www.box.com/shared/co3bn7aeey22ki6r22tf
Very nice tutorial!
For an eLearning lesson, I need to add a flashing/blinking/pulsing effect to the "ball" and need it to repeatedly flash/blink/pulse at a slower pulse (every 500 ms) than the pulsing that would be achieved by:
ball.visible = !ball.visible; (I also tried using setInterval with this visible=!visible and got too rapid a flashing, not able to get 500 ms).
Not sure how to achieve this? (Would prefer, if possible, to achieve this effect all by scripting in a single frame, rather than multiple frames.
Any help appreciated.
Regards,
Hi Ned,
Been playing around with this some more and can get it to work:
function pulsate():void
{
ball.visible=!ball.visible;
}
setInterval(pulsate, 500);
But, when I try to clearInterval, that's when it gets "dicey." I set up a uint var (var myInterval:uint=setInterval(pulsate,500);) so I can clearInterval(myInterval);
Then, each time I reset the game animation (start over), seems the pulsing gets faster and faster. Must have to do with where I am putting the scripts or possibly calling them twice.
After more experimenting, decided to use a Timer instead, which works better for this project.
Regards,
North America
Europe, Middle East and Africa
Asia Pacific