Just re-read your post, if you did put in the loop as we showed, but the led still keeps on flashing, your code is not working right. Did you use the de-bugger to step through your code to see what happens when you hold in the button? You might want to add breakpoints after the delay or it will take a day to step through the code.
I didn't put the loop, I'm sure it works. When I step through the program, I change the timer to 2 cycles, so that I don't have to wait too long for the rest of the code to kick in. Then I replace the proper value once I'm satisfied everything works. With the loop does the program go into a watchdog timer brownout or something like that?
I'll be looking at the AD code, maybe I can just D/L an existing program and include it, that would be too easy...