1. I don't recommend you to use SlidingMenu. It was moved to the old libraries archive for a good reason (
https://www.b4x.com/android/forum/threads/jfeinstein10-slidingmenu-library.36482/).
This is the only issue here.
2. No reason to post a two and a half video. Just post two small code snippets. It will be quicker for us to read and easier to reproduce.
3. While it is not recommended and doesn't really worth discussing too much, you can use variables without declaring them:
x = True 'no error
Log(x) 'no error
If x = True Then 'no error
End If
Log(y) 'error
You can never get the value of a variable that wasn't declared and wasn't assigned anything. When you dim a variable it is assigned the default value.
This is the reason for the error on the If line in your code and the Log(y) in my code.