ImageView-Image Loading Loop

Bainbridge

New Member
Licensed User
Longtime User
Still getting familiar with the product. I'm attempting to load an array of images to an Imageview object, delay for a second, and load a new image, looping for a few times on a Button click. Ideally, my array would have several images, but for this example, I'm left to two. Anyway, the code appears to work, if I pause it with a Message Box, but if I leave it uniteruppted, it doesn't appear to refresh the images. I have to think its something simple I'm overlooking. Thanks for any suggestions/aasistance.

The code is below:

Sub Globals
Dim ImageView1 As ImageView
Dim Button1 As Button
Dim Timex As Timer
Dim x,y,i,Mxm As Int
Dim CachePic(2)As Bitmap
Dim image As Bitmap
Dim NumPics() As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Imagetoggle")
NumPics = Array As String("00","01")
x = 0
Mxm = 1

For i = 0 To CachePic.Length-1
CachePic(i)=LoadBitmap(File.DirAssets,"image-"&NumPics(i)&".jpg")
Next
ImageView1.Bitmap = CachePic(0)
End Sub

Sub Button1_Click
For y = 1 To 10
If x <= Mxm Then
ImageView1.Bitmap=Null
ImageView1.bitmap = CachePic(x)
ImageView1.Visible = True
Sleep(1000)
'Msgbox(Test","Create a Pause")
x = x+1
Else If x > Mxm Then
x = 0
End If
Next
End Sub

Sub Sleep (ms As Long)
ms = DateTime.now+ ms
Do While DateTime.Now < ms
Loop
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…