Let’s check the following code first:
dict[btn1] = false;
How many times do you think the loop would be entered in this case?
NOT only 3!
I run the codes in flash player 11.1, it sometimes was 4! Under flash player 11.5, I haven’t encountered any issue.