I was able to fix it by getting rid of the crouching variable and by saying when the down arrow key is down and z is pressed use the animation, it's more messy but at least it works.
Here's the fix if you want to see:
Download
Also, if I may.. Link is supposed to have 3 walking frames, less friction, and pulls his sword back before and after attacking. You're also using the wrong frames for jumping. Aaaand you might want to make a 'base' or 'collision mask' for Link or he will get hung on ledges and stuff. Ok I'm leaving now..
Thanks for the advice, I recently put in a collision sprite for link, but I didn't like the way link crouched before he jumped and landed in the original, also I made him a little faster and more maneuverable because it was just more fun to move around that way.
Edit Edit:
I downloaded your .cap and I couldn't figure out where you put the walking animation to play or link to stop moving when attacking or crouching.