Hey all i have the following code:
Code:
Dim totalDistance as Boolean = False

Private Sub distanceCheckerTicker()
        Dim totalDistance As Integer = 0 'MAX 1,000

        For Each pair As KeyValuePair(Of String, Integer) In mainMenu.backupSensorData
            totalDistance += pair.Value
            'If (pair.Key = "A") Then totalDistance += pair.Value
            'If (pair.Key = "B") Then totalDistance += pair.Value
            'If (pair.Key = "C") Then totalDistance += pair.Value
            'If (pair.Key = "D") Then totalDistance += pair.Value
        Next

        If totalDistance <= 210 Then
            'red
            If isPlaying = False Then
                isPlaying = True
                WMP.URL = Application.StartupPath + "\red.mp3"
                WMP.controls.stop()
                WMP.controls.play()
                WMP.settings.setMode("loop", True)
            End If

            backupLineRED.Visible = True
            backupLineYELLOW.Visible = False
            backupLineGREEN.Visible = False
        ElseIf totalDistance > 210 And totalDistance <= 670 Then
            'yellow
            WMP.URL = Application.StartupPath + "\yellow.mp3"
            WMP.controls.play()
            backupLineRED.Visible = True
            backupLineYELLOW.Visible = True
            backupLineGREEN.Visible = False
        ElseIf totalDistance > 671 And totalDistance <= 1000 Then
            'green
            WMP.URL = Application.StartupPath + "\green.mp3"
            WMP.controls.play()
            backupLineRED.Visible = True
            backupLineYELLOW.Visible = True
            backupLineGREEN.Visible = True
        End If

        Debug.Print(totalDistance)
    End Sub
I am wanting to loop the sound until it reaches the next IF statement. However i cant think of a way to check for it correctly because isPlaying would always stay true and i need to find a way to set it back to false when it goes into another IF statement.

Any help would be great! Thanks!