Click to See Complete Forum and Search --> : Animation


Drew
April 11th, 2001, 01:25 PM
This code plays a gif file on my form. How can I change the code to play the file just once.

private Sub tmrAnimation_Timer()
static intAnimate as Integer
static intUnload as Integer
static intUpDown as Integer
intAnimate = intAnimate + 1

If intAnimate < 9 then
imgShow.Picture = imgLogo(intAnimate).Picture

else
imgShow.Picture = imgLogo(9).Picture
intAnimate = 0
intUnload = intUnload + 1
End If
End Sub

Joe Keller
April 11th, 2001, 02:48 PM
I figure there are probably lots of ways to only play it once.

One would be... turn the timer off after the last frame of the animation plays

Two.. do not reset the intAnimate variable and do:
If intAnimate = 9 then Exit Sub
as the first line of the sub

Three.. Do not use a timer loop at all.. if you only want the animation to run one time just create a subroutine dedicated to playing the animation, then just call it once.

I would try NOT using timers as much as possible. I am sure there are plenty of other ways to do what you want to do.. thats just a couple suggestions.

Good Luck
Joe