Click to See Complete Forum and Search --> : How do I animate 3 or more images in a control array?


Jim Friedley
March 10th, 2001, 12:02 AM
All I can get is two of the three images to change. Here what I have so far:
Private Sub Timer1_Timer()

static i as integer

i = i + 1
for i = 3 then i = 0
imgLight(0).Picture = imgLight(i).Picture
End Sub

As you can see I have a timer and an image array with three pictures, but only two will change. What do I need to do to get the third picture to change?

CK Dixon
March 10th, 2001, 07:24 AM
Initially, the form shows imglight(0).picture. Note that imgLight(0).picture is replaced by imglight(1). Then, after the first timer tick, imglight(1).picture will be shown. Then, imglight(2) will be shown. Now, i becomes 3, but you set it to 0. But imglight(0).picture is the same as imglight(1).picture. That's why only two show up.

Take another picturebox, and show the images on this picturebox. That will solve your problem.