I'm sure there are better ways to do it. The first thing I can think is that you would need two variables:
- detect in real time which button is pressed (left or right)
- delayed variable that check evert 0.1 second in which direction the player walk (if player is moving, and right is pressed, then is right. Or, if the player is moving, and is not mirrored, then is right...etc.)
Then, you compare these two variables to detect when the player changes direction.
If real time variable is left (the button is being pressed) and the delayed variable is right (because it takes 0.1 sec to turn left) then you know that the player is turning left from the right position. At this point, you can make a boolean which is true, to the action you need to do, and set the boolean back as false. Of course, while the boolean is active you can disable the two actions I described above. When the animation of the player ends, set the boolean to false.