Ok I got it.
What I did was:
1. Removed calling the levels from an array as the levels were going to be numbered anyway. So I just created a global variable called "totalNumberlevels" and used a for loop to print each button
2. Assign a global variable "levelSelected"
3. Used on clicked get the UID instance of the button and passed this to the global variable "levelSelected"
Works a treat.
Onwards and up.....