Hi,
I had a similar sort of problem to this.
The solution I used was to make use of local variables. Make a local
varibale for the array(s) and then for when the button is not being pressed
read this local variable and pass the output back to the array, thus
effectively keeping the state of the array the same.
I don't know if this is the best approach to use, but it does seem to work.
Hope that helps,
Andy.