Sub Process_Globals
Dim beatTimer As Timer
beatTimer.Initialize("beatTimer",1000)
end sub
sub Globals
dim currentBeat as int
dim nrBeats as int
nrBeats=4
end sub
Sub ImageViewPlay_Click
If ImageViewPlay.Tag="0" Then
currentBeat=1
beatTimer.Interval=500 '1000 msec = 1sec
beatTimer.Enabled=True
beatTimer_Tick
ImageViewPlay.Tag="1"
ImageViewPlay.bitmap=LoadBitmap(File.DirAssets,"stop.png")
Else If ImageViewPlay.Tag="1" Then
beatTimer.Enabled=False
ClearBeat 'cset beat color to default gray
ImageViewPlay.Tag="0"
ImageViewPlay.Bitmap=LoadBitmap(File.DirAssets,"play.png")
End If
End Sub
Sub beatTimer_Tick
If nrBeats=4 Then
If currentBeat = 1 Then
beat1.Color = Colors.Green
beat2.Color = Colors.Gray
beat3.Color = Colors.Gray
beat4.Color = Colors.Gray
currentBeat=2
Else If currentBeat = 2 Then
beat1.Color = Colors.Gray
beat2.Color = Colors.red
beat3.Color = Colors.Gray
beat4.Color = Colors.Gray
currentBeat=3
Else If currentBeat = 3 Then
beat1.Color = Colors.Gray
beat2.Color = Colors.gray
beat3.Color = Colors.red
beat4.Color = Colors.Gray
currentBeat=4
Else If currentBeat = 4 Then
beat1.Color = Colors.Gray
beat2.Color = Colors.gray
beat3.Color = Colors.Gray
beat4.Color = Colors.red
currentBeat=1
End If
End If
End Sub